void-packages/srcpkgs/llvm8/files/patches/cfe/cfe-007-ppc-musl-long-double-64.patch
q66 ae921ec4d3 llvm8: clang cross-compiling and musl fixes
This involves two things.

The first thing is fixing the patch that adds musl target triples
into our clang; previously the patch wasn't correct, as it simply
added the musl triples among the GNU triples, which, when cross
compiling to musl targets, resulted in clang considering the GCC
cross installations for glibc and same arch for linking the crt
files; this resulted in broken builds. The new patch only considers
musl triples for musl targets and glibc triples for glibc targets,
so even if you have two cross-gccs installed in parallel for the
same arch (one for musl and one for glibc) it will not pick the
wrong ones.

The second thing is making clang use 64-bit long double for musl
ppc targets correctly. Previously there was no logic for specifying
this and that resulted in 128-bit long double using binaries
emitted by clang for musl and ppc(64). With our specific gcc
setup, that resulted in linking failures as the 128bit ldbl
runtime funcs were not available, and even if they were, the
results would be incorrect.

This also replaces the old zzz-aarch64.patch with a version fixed
for ppc.

[ci skip]

Closes: #11866 [via git-merge-pr]
2019-05-22 20:12:32 +02:00

38 lines
1 KiB
Diff

We need this to ensure musl ppc targets use 64-bit long double, as our libgcc
ships without the 128-bit long double runtime funcs enabled for musl and even
if it did, the resulting binary would be incorrect.
--- a/lib/Basic/Targets/PPC.h
+++ b/lib/Basic/Targets/PPC.h
@@ -342,6 +342,15 @@ public:
break;
}
+ switch (getTriple().getEnvironment()) {
+ case llvm::Triple::Musl:
+ LongDoubleWidth = LongDoubleAlign = 64;
+ LongDoubleFormat = &llvm::APFloat::IEEEdouble();
+ break;
+ default:
+ break;
+ }
+
// PPC32 supports atomics up to 4 bytes.
MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
}
@@ -378,6 +387,15 @@ public:
break;
}
+ switch (getTriple().getEnvironment()) {
+ case llvm::Triple::Musl:
+ LongDoubleWidth = LongDoubleAlign = 64;
+ LongDoubleFormat = &llvm::APFloat::IEEEdouble();
+ break;
+ default:
+ break;
+ }
+
// PPC64 supports atomics up to 8 bytes.
MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
}