Skip to content

Commit b6e3298

Browse files
authored
PowerPC64: Generalize inherit-real-ABI-from-C++-host-compiler logic to all PowerPC64 hosts, not just Linux (#5054)
Should fix #4959 for FreeBSD.
1 parent fbc5d2f commit b6e3298

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#### Platform support
2121
- Supports LLVM 15 - 21.
22+
- PowerPC64: `real` now matches the C++ host compiler's `long double` when compiling for the native target, not just on Linux hosts. (#5054)
2223

2324
#### Bug fixes
2425

gen/target.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,12 @@ llvm::Type *getRealType(const llvm::Triple &triple) {
9898
if (triple.isMusl()) { // Musl uses double
9999
return LLType::getDoubleTy(ctx);
100100
}
101-
#if defined(__linux__) && defined(__powerpc64__)
102-
// for a PowerPC64 Linux build:
103-
// default to the C++ host compiler's `long double` ABI when targeting
104-
// PowerPC64 (non-musl) Linux
105-
if (triple.isOSLinux()) {
101+
#if defined(__powerpc64__)
102+
// for a PowerPC64 LDC build:
103+
// for native builds (targeting some PowerPC64 with native OS), default to
104+
// the C++ host compiler's `long double` ABI
105+
auto nativeTriple = llvm::Triple(llvm::sys::getProcessTriple());
106+
if (triple.getOS() == nativeTriple.getOS()) {
106107
#if __LDBL_MANT_DIG__ == 113
107108
return LLType::getFP128Ty(ctx);
108109
#elif __LDBL_MANT_DIG__ == 106

0 commit comments

Comments
 (0)