aboutsummaryrefslogtreecommitdiffstats
path: root/main/llvm/llvm-3.2-alpine-linux.patch
blob: ecde9e28370e8ea5876f0d71a5c29510dfa0d9f7 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
diff -urp llvm-3.2.src.orig/include/llvm/ADT/Triple.h llvm-3.2.src.new/include/llvm/ADT/Triple.h
--- llvm-3.2.src.orig/include/llvm/ADT/Triple.h	2012-11-15 16:24:48.000000000 -0500
+++ llvm-3.2.src.new/include/llvm/ADT/Triple.h	2013-04-22 04:02:00.691571066 -0400
@@ -115,7 +115,8 @@ public:
     EABI,
     MachO,
     Android,
-    ELF
+    ELF,
+    UClibc
   };
 
 private:
diff -urp llvm-3.2.src.orig/lib/Support/Triple.cpp llvm-3.2.src.new/lib/Support/Triple.cpp
--- llvm-3.2.src.orig/lib/Support/Triple.cpp	2012-11-15 16:24:48.000000000 -0500
+++ llvm-3.2.src.new/lib/Support/Triple.cpp	2013-04-22 04:02:04.568319294 -0400
@@ -147,6 +147,7 @@ const char *Triple::getEnvironmentTypeNa
   case MachO: return "macho";
   case Android: return "android";
   case ELF: return "elf";
+  case UClibc: return "uclibc";
   }
 
   llvm_unreachable("Invalid EnvironmentType!");
@@ -293,6 +294,7 @@ static Triple::EnvironmentType parseEnvi
     .StartsWith("macho", Triple::MachO)
     .StartsWith("android", Triple::Android)
     .StartsWith("elf", Triple::ELF)
+    .StartsWith("uclibc", Triple::UClibc)
     .Default(Triple::UnknownEnvironment);
 }
 
diff -urp llvm-3.2.src.orig/tools/clang/lib/Driver/ToolChains.cpp llvm-3.2.src.new/tools/clang/lib/Driver/ToolChains.cpp
--- llvm-3.2.src.orig/tools/clang/lib/Driver/ToolChains.cpp	2012-12-16 10:59:27.000000000 -0500
+++ llvm-3.2.src.new/tools/clang/lib/Driver/ToolChains.cpp	2013-04-22 04:02:08.788408080 -0400
@@ -1070,7 +1070,8 @@ Generic_GCC::GCCInstallationDetector::GC
     "x86_64-suse-linux",
     "x86_64-manbo-linux-gnu",
     "x86_64-linux-gnu",
-    "x86_64-slackware-linux"
+    "x86_64-slackware-linux",
+    "x86_64-alpine-linux-uclibc"
   };
   static const char *const X86LibDirs[] = { "/lib32", "/lib" };
   static const char *const X86Triples[] = {
@@ -1083,7 +1084,8 @@ Generic_GCC::GCCInstallationDetector::GC
     "i386-redhat-linux",
     "i586-suse-linux",
     "i486-slackware-linux",
-    "i686-montavista-linux"
+    "i686-montavista-linux",
+    "i486-alpine-linux-uclibc"
   };
 
   static const char *const MIPSLibDirs[] = { "/lib" };
@@ -1829,6 +1831,7 @@ Tool &Solaris::SelectTool(const Compilat
 /// Linux toolchain (very bare-bones at the moment).
 
 enum LinuxDistro {
+  AlpineLinux,
   ArchLinux,
   DebianLenny,
   DebianSqueeze,
@@ -1955,6 +1958,9 @@ static LinuxDistro DetectLinuxDistro(llv
   if (!llvm::sys::fs::exists("/etc/arch-release", Exists) && Exists)
     return ArchLinux;
 
+  if (!llvm::sys::fs::exists("/etc/alpine-release", Exists) && Exists)
+    return AlpineLinux;
+
   return UnknownDistro;
 }
 
diff -urp llvm-3.2.src.orig/tools/clang/lib/Driver/Tools.cpp llvm-3.2.src.new/tools/clang/lib/Driver/Tools.cpp
--- llvm-3.2.src.orig/tools/clang/lib/Driver/Tools.cpp	2012-11-21 02:56:23.000000000 -0500
+++ llvm-3.2.src.new/tools/clang/lib/Driver/Tools.cpp	2013-04-22 04:09:34.657814569 -0400
@@ -5975,9 +5975,12 @@ void linuxtools::Link::ConstructJob(Comp
     CmdArgs.push_back("-dynamic-linker");
     if (isAndroid)
       CmdArgs.push_back("/system/bin/linker");
-    else if (ToolChain.getArch() == llvm::Triple::x86)
-      CmdArgs.push_back("/lib/ld-linux.so.2");
-    else if (ToolChain.getArch() == llvm::Triple::arm ||
+    else if (ToolChain.getArch() == llvm::Triple::x86) {
+      if (ToolChain.getTriple().getEnvironment() == llvm::Triple::UClibc)
+        CmdArgs.push_back("/lib/ld-uClibc.so.0.9.32");
+      else
+        CmdArgs.push_back("/lib/ld-linux.so.2");
+    } else if (ToolChain.getArch() == llvm::Triple::arm ||
              ToolChain.getArch() == llvm::Triple::thumb) {
       if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
         CmdArgs.push_back("/lib/ld-linux-armhf.so.3");
@@ -5998,6 +6001,8 @@ void linuxtools::Link::ConstructJob(Comp
       CmdArgs.push_back("/lib/ld.so.1");
     else if (ToolChain.getArch() == llvm::Triple::ppc64)
       CmdArgs.push_back("/lib64/ld64.so.1");
+    else if (ToolChain.getTriple().getEnvironment() == llvm::Triple::UClibc)
+      CmdArgs.push_back("/lib/ld64-uClibc.so.0.9.32");
     else
       CmdArgs.push_back("/lib64/ld-linux-x86-64.so.2");
   }