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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
diff -ru llvm-3.5.0.src.orig/include/llvm/ADT/Triple.h llvm-3.5.0.src/include/llvm/ADT/Triple.h
--- llvm-3.5.0.src.orig/include/llvm/ADT/Triple.h 2014-07-18 17:28:19.000000000 -0300
+++ llvm-3.5.0.src/include/llvm/ADT/Triple.h 2014-11-12 14:44:41.738448045 -0200
@@ -149,6 +149,10 @@
EABIHF,
Android,
+ Musl,
+ MuslEABI,
+ MuslEABIHF,
+
MSVC,
Itanium,
Cygnus,
Only in llvm-3.5.0.src/include/llvm/ADT: Triple.h.orig
diff -ru llvm-3.5.0.src.orig/lib/Support/Triple.cpp llvm-3.5.0.src/lib/Support/Triple.cpp
--- llvm-3.5.0.src.orig/lib/Support/Triple.cpp 2014-07-18 17:28:19.000000000 -0300
+++ llvm-3.5.0.src/lib/Support/Triple.cpp 2014-11-12 14:47:06.565122146 -0200
@@ -168,6 +168,9 @@
case CODE16: return "code16";
case EABI: return "eabi";
case EABIHF: return "eabihf";
+ case Musl: return "musl";
+ case MuslEABI: return "musleabi";
+ case MuslEABIHF: return "musleabihf";
case Android: return "android";
case MSVC: return "msvc";
case Itanium: return "itanium";
@@ -344,6 +347,9 @@
.StartsWith("gnux32", Triple::GNUX32)
.StartsWith("code16", Triple::CODE16)
.StartsWith("gnu", Triple::GNU)
+ .StartsWith("musl", Triple::Musl)
+ .StartsWith("musleabi", Triple::MuslEABI)
+ .StartsWith("musleabihf", Triple::MuslEABIHF)
.StartsWith("android", Triple::Android)
.StartsWith("msvc", Triple::MSVC)
.StartsWith("itanium", Triple::Itanium)
Only in llvm-3.5.0.src/lib/Support: Triple.cpp.orig
diff -ru llvm-3.5.0.src.orig/lib/Target/ARM/ARMSubtarget.cpp llvm-3.5.0.src/lib/Target/ARM/ARMSubtarget.cpp
--- llvm-3.5.0.src.orig/lib/Target/ARM/ARMSubtarget.cpp 2014-07-16 23:13:31.000000000 -0300
+++ llvm-3.5.0.src/lib/Target/ARM/ARMSubtarget.cpp 2014-11-12 14:50:40.025133104 -0200
@@ -273,6 +273,8 @@
case Triple::EABIHF:
case Triple::GNUEABI:
case Triple::GNUEABIHF:
+ case Triple::MuslEABI:
+ case Triple::MuslEABIHF:
TargetABI = ARM_ABI_AAPCS;
break;
default:
diff -ru llvm-3.5.0.src.orig/lib/Target/ARM/ARMSubtarget.h llvm-3.5.0.src/lib/Target/ARM/ARMSubtarget.h
--- llvm-3.5.0.src.orig/lib/Target/ARM/ARMSubtarget.h 2014-07-16 23:13:31.000000000 -0300
+++ llvm-3.5.0.src/lib/Target/ARM/ARMSubtarget.h 2014-11-12 14:53:36.571808822 -0200
@@ -372,8 +372,10 @@
bool isTargetEHABICompatible() const {
return (TargetTriple.getEnvironment() == Triple::EABI ||
TargetTriple.getEnvironment() == Triple::GNUEABI ||
+ TargetTriple.getEnvironment() == Triple::MuslEABI ||
TargetTriple.getEnvironment() == Triple::EABIHF ||
TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
+ TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
TargetTriple.getEnvironment() == Triple::Android) &&
!isTargetDarwin() && !isTargetWindows();
}
diff -ru llvm-3.5.0.src.orig/tools/clang/lib/Driver/ToolChains.cpp llvm-3.5.0.src/tools/clang/lib/Driver/ToolChains.cpp
--- llvm-3.5.0.src.orig/tools/clang/lib/Driver/ToolChains.cpp 2014-08-27 23:07:31.000000000 -0300
+++ llvm-3.5.0.src/tools/clang/lib/Driver/ToolChains.cpp 2014-11-12 15:09:14.805190323 -0200
@@ -1324,7 +1324,9 @@
static const char *const ARMTriples[] = { "arm-linux-gnueabi",
"arm-linux-androideabi" };
static const char *const ARMHFTriples[] = { "arm-linux-gnueabihf",
- "armv7hl-redhat-linux-gnueabi" };
+ "armv7hl-redhat-linux-gnueabi",
+ "armv6-alpine-linux-muslgnueabihf",
+ "armv7-alpine-linux-muslgnueabihf" };
static const char *const ARMebLibDirs[] = { "/lib" };
static const char *const ARMebTriples[] = { "armeb-linux-gnueabi",
"armeb-linux-androideabi" };
@@ -1336,7 +1338,7 @@
"x86_64-linux-gnu", "x86_64-unknown-linux-gnu", "x86_64-pc-linux-gnu",
"x86_64-redhat-linux6E", "x86_64-redhat-linux", "x86_64-suse-linux",
"x86_64-manbo-linux-gnu", "x86_64-linux-gnu", "x86_64-slackware-linux",
- "x86_64-linux-android", "x86_64-unknown-linux"
+ "x86_64-linux-android", "x86_64-alpine-linux-musl", "x86_64-unknown-linux"
};
static const char *const X32LibDirs[] = { "/libx32" };
static const char *const X86LibDirs[] = { "/lib32", "/lib" };
@@ -1344,7 +1346,8 @@
"i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu", "i386-linux-gnu",
"i386-redhat-linux6E", "i686-redhat-linux", "i586-redhat-linux",
"i386-redhat-linux", "i586-suse-linux", "i486-slackware-linux",
- "i686-montavista-linux", "i686-linux-android", "i586-linux-gnu"
+ "i686-montavista-linux", "i686-linux-android", "i586-linux-gnu",
+ "i486-alpine-linux-musl"
};
static const char *const MIPSLibDirs[] = { "/lib" };
@@ -2777,6 +2780,7 @@
/// Distribution (very bare-bones at the moment).
enum Distro {
+ AlpineLinux,
ArchLinux,
DebianLenny,
DebianSqueeze,
@@ -2888,6 +2892,9 @@
if (llvm::sys::fs::exists("/etc/arch-release"))
return ArchLinux;
+ if (llvm::sys::fs::exists("/etc/alpine-release"))
+ return AlpineLinux;
+
return UnknownDistro;
}
@@ -3042,7 +3049,7 @@
Distro Distro = DetectDistro(Arch);
- if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) {
+ if (IsOpenSUSE(Distro) || IsUbuntu(Distro) || Distro == AlpineLinux) {
ExtraOpts.push_back("-z");
ExtraOpts.push_back("relro");
}
diff -ru llvm-3.5.0.src.orig/tools/clang/lib/Driver/Tools.cpp llvm-3.5.0.src/tools/clang/lib/Driver/Tools.cpp
--- llvm-3.5.0.src.orig/tools/clang/lib/Driver/Tools.cpp 2014-08-07 07:51:51.000000000 -0300
+++ llvm-3.5.0.src/tools/clang/lib/Driver/Tools.cpp 2014-11-12 15:11:31.901864030 -0200
@@ -7182,8 +7182,14 @@
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 ||
ToolChain.getArch() == llvm::Triple::arm64)
@@ -7193,10 +7199,17 @@
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)
@@ -7227,8 +7240,14 @@
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,
|