void-packages/srcpkgs/llvm/files/patches/cfe/cfe-005-fix-dynamic-linker-paths.patch
Andrea Brancaleoni e8e81d004e llvm: update to 3.7.0.
- add patch debug messages
- update patches
- remove lld
- replace __ptrace_request with int on musl
- fix bug 22661
- include license
2015-09-10 23:21:44 +02:00

86 lines
3.3 KiB
Diff

From edd1fc14b3c3e05b14c3ab1917515a11bc477aca Mon Sep 17 00:00:00 2001
From: Andrea Brancaleoni <miwaxe@gmail.com>
Date: Tue, 8 Sep 2015 22:33:28 +0200
Subject: [PATCH 4/7] fix dynamic linker paths
---
lib/Driver/Tools.cpp | 43 ++++++++++++++++++++++++++++++++++++++-----
1 file changed, 38 insertions(+), 5 deletions(-)
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 19ebbb9..4384829 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -7958,7 +7958,14 @@ static std::string getLinuxDynamicLinker(const ArgList &Args,
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)
@@ -7970,14 +7977,34 @@ static std::string getLinuxDynamicLinker(const ArgList &Args,
tools::arm::getARMFloatABI(ToolChain.getDriver(), Args, ToolChain.getTriple()) == "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::armeb || Arch == llvm::Triple::thumbeb) {
// TODO: check which dynamic linker name.
if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF ||
tools::arm::getARMFloatABI(ToolChain.getDriver(), Args, ToolChain.getTriple()) == "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) {
StringRef CPUName;
@@ -8014,8 +8041,14 @@ static std::string getLinuxDynamicLinker(const ArgList &Args,
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,
--
2.5.1