3 # Parent 6b1b8174ce29396d7dbd482296f43eba38948222
4 Support for arm-linux-musl.
6 diff -r 6b1b8174ce29 gcc/config/arm/linux-eabi.h
7 --- a/gcc/config/arm/linux-eabi.h Fri Mar 29 16:41:20 2013 -0400
8 +++ b/gcc/config/arm/linux-eabi.h Fri Mar 29 16:41:23 2013 -0400
10 %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
11 %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
13 +/* musl has no "classic" (i.e. broken) mode */
14 +#undef MUSL_DYNAMIC_LINKER
15 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
17 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
18 use the GNU/Linux version, not the generic BPABI version. */
20 diff -r 6b1b8174ce29 libitm/config/arm/hwcap.cc
21 --- a/libitm/config/arm/hwcap.cc Fri Mar 29 16:41:20 2013 -0400
22 +++ b/libitm/config/arm/hwcap.cc Fri Mar 29 16:41:23 2013 -0400
28 #include <sys/fcntl.h>
34 static void __attribute__((constructor))
36 # Parent 2b29df135cf04fe23c38301f6d0fc5796366aecf
37 Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker.
39 diff -r 2b29df135cf0 gcc/config.gcc
40 --- a/gcc/config.gcc Fri Mar 29 16:41:11 2013 -0400
41 +++ b/gcc/config.gcc Fri Mar 29 16:41:14 2013 -0400
46 -tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
47 +tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
49 # Common parts for widely ported systems.
53 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
56 + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
59 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
61 diff -r 2b29df135cf0 gcc/config/linux.h
62 --- a/gcc/config/linux.h Fri Mar 29 16:41:11 2013 -0400
63 +++ b/gcc/config/linux.h Fri Mar 29 16:41:14 2013 -0400
65 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
66 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
67 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
68 +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
70 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
71 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
72 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
73 +#define OPTION_MUSL (linux_libc == LIBC_MUSL)
76 #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
78 uClibc or Bionic is the default C library and whether
79 -muclibc or -mglibc or -mbionic has been passed to change the default. */
81 -#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
82 - "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
83 +#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
84 + "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
86 #if DEFAULT_LIBC == LIBC_GLIBC
87 -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
88 - CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
89 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
90 + CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
91 #elif DEFAULT_LIBC == LIBC_UCLIBC
92 -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
93 - CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
94 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
95 + CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
96 #elif DEFAULT_LIBC == LIBC_BIONIC
97 -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
98 - CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
99 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
100 + CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
101 +#elif DEFAULT_LIBC == LIBC_MUSL
102 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
103 + CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
105 #error "Unsupported DEFAULT_LIBC"
106 #endif /* DEFAULT_LIBC */
109 #define GNU_USER_DYNAMIC_LINKER \
110 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
111 - BIONIC_DYNAMIC_LINKER)
112 + BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
113 #define GNU_USER_DYNAMIC_LINKER32 \
114 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
115 - BIONIC_DYNAMIC_LINKER32)
116 + BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
117 #define GNU_USER_DYNAMIC_LINKER64 \
118 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
119 - BIONIC_DYNAMIC_LINKER64)
120 + BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
121 #define GNU_USER_DYNAMIC_LINKERX32 \
122 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
123 - BIONIC_DYNAMIC_LINKERX32)
124 + BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
126 /* Determine whether the entire c99 runtime
127 is present in the runtime library. */
128 diff -r 2b29df135cf0 gcc/config/linux.opt
129 --- a/gcc/config/linux.opt Fri Mar 29 16:41:11 2013 -0400
130 +++ b/gcc/config/linux.opt Fri Mar 29 16:41:14 2013 -0400
133 Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
137 +Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
139 diff -r 2b29df135cf0 gcc/ginclude/stddef.h
140 --- a/gcc/ginclude/stddef.h Fri Mar 29 16:41:11 2013 -0400
141 +++ b/gcc/ginclude/stddef.h Fri Mar 29 16:41:14 2013 -0400
146 +#ifndef __DEFINED_size_t /* musl */
147 #define __size_t__ /* BeOS */
148 #define __SIZE_T__ /* Cray Unicos/Mk */
151 #define ___int_size_t_h
154 +#define __DEFINED_size_t /* musl */
155 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
156 || defined(__FreeBSD_kernel__)
157 /* __size_t is a typedef on FreeBSD 5, must not trash it. */
159 typedef long ssize_t;
160 #endif /* __BEOS__ */
161 #endif /* !(defined (__GNUG__) && defined (size_t)) */
162 +#endif /* __DEFINED_size_t */
163 #endif /* __size_t */
165 #endif /* _GCC_SIZE_T */
167 # Parent 2b94537ce2496c88e7e797c617e5b95e8d7e4785
168 A fix for libgomp to correctly request a POSIX version for time support.
170 diff -r 2b94537ce249 libgomp/config/posix/time.c
171 --- a/libgomp/config/posix/time.c Fri Mar 29 16:41:14 2013 -0400
172 +++ b/libgomp/config/posix/time.c Fri Mar 29 16:41:17 2013 -0400
174 The following implementation uses the most simple POSIX routines.
175 If present, POSIX 4 clocks should be used instead. */
177 +#define _POSIX_C_SOURCE 199309L /* for clocks */
181 #if TIME_WITH_SYS_TIME
183 # Parent f50bb54f331f73405131a30b4f353cfda1c70304
184 Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
186 diff -r f50bb54f331f libstdc++-v3/configure.host
187 --- a/libstdc++-v3/configure.host Fri Mar 29 16:38:52 2013 -0400
188 +++ b/libstdc++-v3/configure.host Fri Mar 29 16:41:10 2013 -0400
190 os_include_dir="os/bsd/freebsd"
192 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
193 + # check for musl by target
194 + case "${host_os}" in
196 + os_include_dir="os/generic"
200 if [ "$uclibc" = "yes" ]; then
201 os_include_dir="os/uclibc"
202 elif [ "$bionic" = "yes" ]; then
204 os_include_dir="os/gnu-linux"
211 os_include_dir="os/hpux"
214 # Parent 62831d7bf931658019ba16092c48375177d014b1
215 Support for mips-linux-musl.
217 diff -r 62831d7bf931 gcc/config/mips/linux.h
218 --- a/gcc/config/mips/linux.h Fri Mar 29 16:41:23 2013 -0400
219 +++ b/gcc/config/mips/linux.h Fri Mar 29 16:41:25 2013 -0400
221 <http://www.gnu.org/licenses/>. */
223 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
225 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
227 # Parent 2ffe76b215fdb082cbbc262536077627757fa9bf
228 Support for powerpc-linux-musl.
230 diff -r 2ffe76b215fd gcc/config.gcc
231 --- a/gcc/config.gcc Fri Mar 29 16:41:26 2013 -0400
232 +++ b/gcc/config.gcc Fri Mar 29 16:41:28 2013 -0400
233 @@ -2112,6 +2112,10 @@
234 powerpc*-*-linux*paired*)
235 tm_file="${tm_file} rs6000/750cl.h" ;;
239 + enable_secureplt=yes ;;
241 if test x${enable_secureplt} = xyes; then
242 tm_file="rs6000/secureplt.h ${tm_file}"
244 diff -r 2ffe76b215fd gcc/config/rs6000/linux64.h
245 --- a/gcc/config/rs6000/linux64.h Fri Mar 29 16:41:26 2013 -0400
246 +++ b/gcc/config/rs6000/linux64.h Fri Mar 29 16:41:28 2013 -0400
247 @@ -364,17 +364,21 @@
248 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
249 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
250 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
251 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
252 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
253 #if DEFAULT_LIBC == LIBC_UCLIBC
254 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
255 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
256 #elif DEFAULT_LIBC == LIBC_GLIBC
257 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
258 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
259 +#elif DEFAULT_LIBC == LIBC_MUSL
260 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
262 #error "Unsupported DEFAULT_LIBC"
264 #define GNU_USER_DYNAMIC_LINKER32 \
265 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
266 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
267 #define GNU_USER_DYNAMIC_LINKER64 \
268 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
269 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
272 #define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
273 diff -r 2ffe76b215fd gcc/config/rs6000/secureplt.h
274 --- a/gcc/config/rs6000/secureplt.h Fri Mar 29 16:41:26 2013 -0400
275 +++ b/gcc/config/rs6000/secureplt.h Fri Mar 29 16:41:28 2013 -0400
277 <http://www.gnu.org/licenses/>. */
279 #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
280 +#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
281 diff -r 2ffe76b215fd gcc/config/rs6000/sysv4.h
282 --- a/gcc/config/rs6000/sysv4.h Fri Mar 29 16:41:26 2013 -0400
283 +++ b/gcc/config/rs6000/sysv4.h Fri Mar 29 16:41:28 2013 -0400
285 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
286 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
288 +#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
289 +#define LINK_SECURE_PLT_DEFAULT_SPEC ""
292 /* Pass -G xxx to the compiler and set correct endian mode. */
293 #define CC1_SPEC "%{G*} %(cc1_cpu) \
295 %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
296 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
297 %{mcall-i960-old: --oformat elf32-powerpcle} \
300 +%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
302 /* Any specific OS flags. */
303 #define LINK_OS_SPEC "\
304 @@ -789,15 +793,18 @@
306 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
307 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
308 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
309 #if DEFAULT_LIBC == LIBC_UCLIBC
310 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
311 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
312 +#elif DEFAULT_LIBC == LIBC_MUSL
313 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
314 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
315 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
316 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
318 #error "Unsupported DEFAULT_LIBC"
320 #define GNU_USER_DYNAMIC_LINKER \
321 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
322 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
324 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
325 %{rdynamic:-export-dynamic} \
327 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
328 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
329 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
330 + { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
331 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
332 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
333 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
334 diff -r 2ffe76b215fd libgcc/config/rs6000/linux-unwind.h
335 --- a/libgcc/config/rs6000/linux-unwind.h Fri Mar 29 16:41:26 2013 -0400
336 +++ b/libgcc/config/rs6000/linux-unwind.h Fri Mar 29 16:41:28 2013 -0400
339 return _URC_NO_REASON;
343 #define MD_FROB_UPDATE_CONTEXT frob_update_context
346 # Parent 3ea10cd626cb7abdfd56d3fe8d2c9ed58a82797b
347 Support for i386-linux-musl and x86_64-linux-musl.
349 diff -r 3ea10cd626cb gcc/config/i386/linux.h
350 --- a/gcc/config/i386/linux.h Fri Mar 29 16:41:17 2013 -0400
351 +++ b/gcc/config/i386/linux.h Fri Mar 29 16:41:20 2013 -0400
354 #define GNU_USER_LINK_EMULATION "elf_i386"
355 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
356 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
357 diff -r 3ea10cd626cb gcc/config/i386/linux64.h
358 --- a/gcc/config/i386/linux64.h Fri Mar 29 16:41:17 2013 -0400
359 +++ b/gcc/config/i386/linux64.h Fri Mar 29 16:41:20 2013 -0400
361 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
362 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
363 #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
365 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
366 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
367 +#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
368 diff -r 3ea10cd626cb libitm/config/linux/x86/tls.h
369 --- a/libitm/config/linux/x86/tls.h Fri Mar 29 16:41:17 2013 -0400
370 +++ b/libitm/config/linux/x86/tls.h Fri Mar 29 16:41:20 2013 -0400
372 #ifndef LIBITM_X86_TLS_H
373 #define LIBITM_X86_TLS_H 1
375 -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
376 +#if defined(__GLIBC_PREREQ)
377 +#if __GLIBC_PREREQ(2, 10)
378 /* Use slots in the TCB head rather than __thread lookups.
379 GLIBC has reserved words 10 through 13 for TM. */
380 #define HAVE_ARCH_GTM_THREAD 1
381 #define HAVE_ARCH_GTM_THREAD_DISP 1
385 #include "config/generic/tls.h"
387 -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
388 +#if defined(__GLIBC_PREREQ)
389 +#if __GLIBC_PREREQ(2, 10)
390 namespace GTM HIDDEN {
396 #endif /* >= GLIBC 2.10 */
399 #endif // LIBITM_X86_TLS_H