summaryrefslogtreecommitdiffstats
path: root/testing/llvm/clang-3.6-musl-fix-dynamic-linker-paths.patch
blob: 27c17728cef94a0c7bcd0b44e481e9148101bb38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 75eef9e..3e71522 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -7282,8 +7282,14 @@ static std::string getLinuxDynamicLinker(const ArgList &Args,
       return "/system/bin/linker64";
     else
       return "/system/bin/linker";
-  } else if (ToolChain.getArch() == llvm::Triple::x86 ||
-             ToolChain.getArch() == llvm::Triple::sparc)
+  } else if (ToolChain.getArch() == 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 (ToolChain.getArch() == llvm::Triple::sparc)
     return "/lib/ld-linux.so.2";
   else if (ToolChain.getArch() == llvm::Triple::aarch64)
     return "/lib/ld-linux-aarch64.so.1";
@@ -7291,10 +7297,17 @@ static std::string getLinuxDynamicLinker(const ArgList &Args,
     return "/lib/ld-linux-aarch64_be.so.1";
   else if (ToolChain.getArch() == llvm::Triple::arm ||
            ToolChain.getArch() == llvm::Triple::thumb) {
-    if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
+    switch (ToolChain.getTriple().getEnvironment()) {
+    case llvm::Triple::Musl:
+    case llvm::Triple::MuslEABI:
+      return "/lib/ld-musl-arm.so.3";
+    case llvm::Triple::MuslEABIHF:
+      return "/lib/ld-musl-armhf.so.3";
+    case llvm::Triple::GNUEABIHF:
       return "/lib/ld-linux-armhf.so.3";
-    else
+    default:
       return "/lib/ld-linux.so.3";
+    }
   } else if (ToolChain.getArch() == llvm::Triple::armeb ||
              ToolChain.getArch() == llvm::Triple::thumbeb) {
     if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
@@ -7339,8 +7352,14 @@ static std::string getLinuxDynamicLinker(const ArgList &Args,
   else if (ToolChain.getArch() == 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,