void-packages/srcpkgs/llvm/files/patches/cfe/cfe-005-fix-dynamic-linker-...

55 lines
1.9 KiB
Diff

--- cfe-3.8.0.src/lib/Driver/Tools.cpp.orig
+++ cfe-3.8.0.src/lib/Driver/Tools.cpp
@@ -8632,7 +8632,14 @@
return "/system/bin/linker64";
else
return "/system/bin/linker";
- } else if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::sparc ||
+ } else if (Arch == llvm::Triple::x86) {
+ switch (ToolChain.getTriple().getEnvironment()) {
+ case llvm::Triple::Musl:
+ return "/lib/ld-musl-i386.so.1";
+ default:
+ return "/lib/ld-linux.so.2";
+ }
+ } else if (Arch == llvm::Triple::sparc ||
Arch == llvm::Triple::sparcel)
return "/lib/ld-linux.so.2";
else if (Arch == llvm::Triple::aarch64)
@@ -8651,7 +8658,17 @@
arm::getARMFloatABI(ToolChain, Args) == arm::FloatABI::Hard)
return "/lib/ld-linux-armhf.so.3";
else
- return "/lib/ld-linux.so.3";
+ switch (ToolChain.getTriple().getEnvironment()) {
+ case llvm::Triple::Musl:
+ case llvm::Triple::MuslEABI:
+ return "/lib/ld-musl-arm.so.1";
+ case llvm::Triple::MuslEABIHF:
+ return "/lib/ld-musl-armhf.so.1";
+ case llvm::Triple::GNUEABIHF:
+ return "/lib/ld-linux-armhf.so.1";
+ default:
+ return "/lib/ld-linux.so.3";
+ }
} else if (Arch == llvm::Triple::mips || Arch == llvm::Triple::mipsel ||
Arch == llvm::Triple::mips64 || Arch == llvm::Triple::mips64el) {
std::string LibDir =
@@ -8685,8 +8702,14 @@
else if (Arch == llvm::Triple::x86_64 &&
ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUX32)
return "/libx32/ld-linux-x32.so.2";
- else
- return "/lib64/ld-linux-x86-64.so.2";
+ else {
+ switch (ToolChain.getTriple().getEnvironment()) {
+ case llvm::Triple::Musl:
+ return "/lib/ld-musl-x86_64.so.1";
+ default:
+ return "/lib64/ld-linux-x86-64.so.2";
+ }
+ }
}
static void AddRunTimeLibs(const ToolChain &TC, const Driver &D,