Skip to content

[libcxxabi] Fix the long double demangling for PowerPC #135332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2025

Conversation

mstorsjo
Copy link
Member

PowerPC uses a slightly different type of floats for their 128 bit long doubles, as "double-double", with LDBL_MANT_DIG == 106 rather than LDBL_MANT_DIG == 113 for IEEE 128 bit floats.

This fixes compiling libcxxabi for PowerPC after
3b70715.

PowerPC uses a slightly different type of floats for their 128
bit long doubles, as "double-double", with __LDBL_MANT_DIG__ == 106
rather than __LDBL_MANT_DIG__ == 113 for IEEE 128 bit floats.

This fixes compiling libcxxabi for PowerPC after
3b70715.
@mstorsjo mstorsjo requested a review from a team as a code owner April 11, 2025 08:58
@llvmbot llvmbot added the libc++abi libc++abi C++ Runtime Library. Not libc++. label Apr 11, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 11, 2025

@llvm/pr-subscribers-libcxxabi

Author: Martin Storsjö (mstorsjo)

Changes

PowerPC uses a slightly different type of floats for their 128 bit long doubles, as "double-double", with LDBL_MANT_DIG == 106 rather than LDBL_MANT_DIG == 113 for IEEE 128 bit floats.

This fixes compiling libcxxabi for PowerPC after
3b70715.


Full diff: https://github.com/llvm/llvm-project/pull/135332.diff

1 Files Affected:

  • (modified) libcxxabi/src/demangle/ItaniumDemangle.h (+1-1)
diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h
index b9d17060c04f9..eca9ddad66f92 100644
--- a/libcxxabi/src/demangle/ItaniumDemangle.h
+++ b/libcxxabi/src/demangle/ItaniumDemangle.h
@@ -5741,7 +5741,7 @@ struct FloatData<double>
 template <>
 struct FloatData<long double>
 {
-#if __LDBL_MANT_DIG__ == 113
+#if __LDBL_MANT_DIG__ == 113 || __LDBL_MANT_DIG__ == 106
   static const size_t mangled_size = 32;
 #elif __LDBL_MANT_DIG__ == 53 || defined(_MSC_VER)
   // MSVC doesn't define __LDBL_MANT_DIG__, but it has long double equal to

@mstorsjo
Copy link
Member Author

If ok, I would like to merge this one without waiting for the full CI pipeline, as this fixes a broken buildbot at https://lab.llvm.org/buildbot/#/builders/72/builds/10061.

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine to land without waiting for the CI. We don't have anything in the CI that would catch this anyways.

@mstorsjo
Copy link
Member Author

I think this is fine to land without waiting for the CI. We don't have anything in the CI that would catch this anyways.

Thanks! And as long as at least some CI tasks have completed successfully, we can be kinda safe that the patch isn't entirely broken (causing compilation of libcxxabi to fail). Landing it now.

@mstorsjo mstorsjo merged commit 8be4bd8 into llvm:main Apr 11, 2025
19 of 32 checks passed
@mstorsjo mstorsjo deleted the libcxxabi-demangle-ppc branch April 11, 2025 09:24
var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
PowerPC uses a slightly different type of floats for their 128 bit long
doubles, as "double-double", with __LDBL_MANT_DIG__ == 106 rather than
__LDBL_MANT_DIG__ == 113 for IEEE 128 bit floats.

This fixes compiling libcxxabi for PowerPC after
3b70715.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++abi libc++abi C++ Runtime Library. Not libc++.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants