GCC 4.8.2
[rofl0r-mmix-cross.git] / patches / gcc-4.8.1-musl.diff
blob2d0934ea00f671a8a9ee3ce9ba3b7990bdbc1b13
1 # HG changeset patch
2 # Parent f50bb54f331f73405131a30b4f353cfda1c70304
3 Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
5 diff -r f50bb54f331f libstdc++-v3/configure.host
6 --- a/libstdc++-v3/configure.host Fri Mar 29 16:38:52 2013 -0400
7 +++ b/libstdc++-v3/configure.host Fri Mar 29 16:41:10 2013 -0400
8 @@ -264,6 +264,13 @@
9 os_include_dir="os/bsd/freebsd"
11 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
12 + # check for musl by target
13 + case "${host_os}" in
14 + *-musl*)
15 + os_include_dir="os/generic"
16 + ;;
17 + *)
19 if [ "$uclibc" = "yes" ]; then
20 os_include_dir="os/uclibc"
21 elif [ "$bionic" = "yes" ]; then
22 @@ -272,6 +279,9 @@
23 os_include_dir="os/gnu-linux"
27 + esac
28 + ;;
29 hpux*)
30 os_include_dir="os/hpux"
32 # HG changeset patch
33 # Parent 572f7b4d1c50cefde3aa2c43d06040fc308ad989
34 Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker.
36 diff -r 572f7b4d1c50 gcc/config.gcc
37 --- a/gcc/config.gcc Sun Sep 08 22:58:18 2013 -0400
38 +++ b/gcc/config.gcc Mon Sep 09 12:48:34 2013 -0400
39 @@ -549,7 +549,7 @@
40 esac
42 # Common C libraries.
43 -tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
44 +tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
46 # Common parts for widely ported systems.
47 case ${target} in
48 @@ -652,6 +652,9 @@
49 *-*-*uclibc*)
50 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
52 + *-*-*musl*)
53 + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
54 + ;;
56 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
58 diff -r 572f7b4d1c50 gcc/config/linux.h
59 --- a/gcc/config/linux.h Sun Sep 08 22:58:18 2013 -0400
60 +++ b/gcc/config/linux.h Mon Sep 09 12:48:34 2013 -0400
61 @@ -32,10 +32,12 @@
62 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
63 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
64 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
65 +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
66 #else
67 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
68 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
69 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
70 +#define OPTION_MUSL (linux_libc == LIBC_MUSL)
71 #endif
73 #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
74 @@ -53,18 +55,21 @@
75 uClibc or Bionic is the default C library and whether
76 -muclibc or -mglibc or -mbionic has been passed to change the default. */
78 -#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
79 - "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
80 +#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
81 + "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
83 #if DEFAULT_LIBC == LIBC_GLIBC
84 -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
85 - CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
86 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
87 + CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
88 #elif DEFAULT_LIBC == LIBC_UCLIBC
89 -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
90 - CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
91 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
92 + CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
93 #elif DEFAULT_LIBC == LIBC_BIONIC
94 -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
95 - CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
96 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
97 + CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
98 +#elif DEFAULT_LIBC == LIBC_MUSL
99 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
100 + CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
101 #else
102 #error "Unsupported DEFAULT_LIBC"
103 #endif /* DEFAULT_LIBC */
104 @@ -84,21 +89,21 @@
106 #define GNU_USER_DYNAMIC_LINKER \
107 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
108 - BIONIC_DYNAMIC_LINKER)
109 + BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
110 #define GNU_USER_DYNAMIC_LINKER32 \
111 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
112 - BIONIC_DYNAMIC_LINKER32)
113 + BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
114 #define GNU_USER_DYNAMIC_LINKER64 \
115 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
116 - BIONIC_DYNAMIC_LINKER64)
117 + BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
118 #define GNU_USER_DYNAMIC_LINKERX32 \
119 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
120 - BIONIC_DYNAMIC_LINKERX32)
121 + BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
123 /* Determine whether the entire c99 runtime
124 is present in the runtime library. */
125 #undef TARGET_C99_FUNCTIONS
126 -#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
127 +#define TARGET_C99_FUNCTIONS (OPTION_GLIBC || OPTION_MUSL)
129 /* Whether we have sincos that follows the GNU extension. */
130 #undef TARGET_HAS_SINCOS
131 @@ -107,3 +112,74 @@
132 /* Whether we have Bionic libc runtime */
133 #undef TARGET_HAS_BIONIC
134 #define TARGET_HAS_BIONIC (OPTION_BIONIC)
136 +/* musl avoids problematic includes by rearranging the include directories.
137 + * Unfortunately, this is mostly duplicated from cppdefault.c */
138 +#if DEFAULT_LIBC == LIBC_MUSL
139 +#define INCLUDE_DEFAULTS_MUSL_GPP \
140 + { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
141 + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
142 + { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
143 + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
144 + { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
145 + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
147 +#ifdef LOCAL_INCLUDE_DIR
148 +#define INCLUDE_DEFAULTS_MUSL_LOCAL \
149 + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
150 + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
151 +#else
152 +#define INCLUDE_DEFAULTS_MUSL_LOCAL
153 +#endif
155 +#ifdef PREFIX_INCLUDE_DIR
156 +#define INCLUDE_DEFAULTS_MUSL_PREFIX \
157 + { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
158 +#else
159 +#define INCLUDE_DEFAULTS_MUSL_PREFIX
160 +#endif
162 +#ifdef CROSS_INCLUDE_DIR
163 +#define INCLUDE_DEFAULTS_MUSL_CROSS \
164 + { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
165 +#else
166 +#define INCLUDE_DEFAULTS_MUSL_CROSS
167 +#endif
169 +#ifdef TOOL_INCLUDE_DIR
170 +#define INCLUDE_DEFAULTS_MUSL_TOOL \
171 + { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
172 +#else
173 +#define INCLUDE_DEFAULTS_MUSL_TOOL
174 +#endif
176 +#ifdef NATIVE_SYSTEM_HEADER_DIR
177 +#define INCLUDE_DEFAULTS_MUSL_NATIVE \
178 + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
179 + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
180 +#else
181 +#define INCLUDE_DEFAULTS_MUSL_NATIVE
182 +#endif
184 +#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
185 +# undef INCLUDE_DEFAULTS_MUSL_LOCAL
186 +# define INCLUDE_DEFAULTS_MUSL_LOCAL
187 +# undef INCLUDE_DEFAULTS_MUSL_NATIVE
188 +# define INCLUDE_DEFAULTS_MUSL_NATIVE
189 +#else
190 +# undef INCLUDE_DEFAULTS_MUSL_CROSS
191 +# define INCLUDE_DEFAULTS_MUSL_CROSS
192 +#endif
194 +#undef INCLUDE_DEFAULTS
195 +#define INCLUDE_DEFAULTS \
196 + { \
197 + INCLUDE_DEFAULTS_MUSL_GPP \
198 + INCLUDE_DEFAULTS_MUSL_PREFIX \
199 + INCLUDE_DEFAULTS_MUSL_CROSS \
200 + INCLUDE_DEFAULTS_MUSL_TOOL \
201 + INCLUDE_DEFAULTS_MUSL_NATIVE \
202 + { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
203 + { 0, 0, 0, 0, 0, 0 } \
205 +#endif
206 diff -r 572f7b4d1c50 gcc/config/linux.opt
207 --- a/gcc/config/linux.opt Sun Sep 08 22:58:18 2013 -0400
208 +++ b/gcc/config/linux.opt Mon Sep 09 12:48:34 2013 -0400
209 @@ -30,3 +30,7 @@
210 muclibc
211 Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
212 Use uClibc C library
214 +mmusl
215 +Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
216 +Use musl C library
217 diff -r 572f7b4d1c50 gcc/ginclude/stddef.h
218 --- a/gcc/ginclude/stddef.h Sun Sep 08 22:58:18 2013 -0400
219 +++ b/gcc/ginclude/stddef.h Mon Sep 09 12:48:34 2013 -0400
220 @@ -181,6 +181,7 @@
221 #ifndef _GCC_SIZE_T
222 #ifndef _SIZET_
223 #ifndef __size_t
224 +#ifndef __DEFINED_size_t /* musl */
225 #define __size_t__ /* BeOS */
226 #define __SIZE_T__ /* Cray Unicos/Mk */
227 #define _SIZE_T
228 @@ -197,6 +198,7 @@
229 #define ___int_size_t_h
230 #define _GCC_SIZE_T
231 #define _SIZET_
232 +#define __DEFINED_size_t /* musl */
233 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
234 || defined(__FreeBSD_kernel__)
235 /* __size_t is a typedef on FreeBSD 5, must not trash it. */
236 @@ -214,6 +216,7 @@
237 typedef long ssize_t;
238 #endif /* __BEOS__ */
239 #endif /* !(defined (__GNUG__) && defined (size_t)) */
240 +#endif /* __DEFINED_size_t */
241 #endif /* __size_t */
242 #endif /* _SIZET_ */
243 #endif /* _GCC_SIZE_T */
244 # HG changeset patch
245 # Parent 2b94537ce2496c88e7e797c617e5b95e8d7e4785
246 A fix for libgomp to correctly request a POSIX version for time support.
248 diff -r 2b94537ce249 libgomp/config/posix/time.c
249 --- a/libgomp/config/posix/time.c Fri Mar 29 16:41:14 2013 -0400
250 +++ b/libgomp/config/posix/time.c Fri Mar 29 16:41:17 2013 -0400
251 @@ -28,6 +28,8 @@
252 The following implementation uses the most simple POSIX routines.
253 If present, POSIX 4 clocks should be used instead. */
255 +#define _POSIX_C_SOURCE 199309L /* for clocks */
257 #include "libgomp.h"
258 #include <unistd.h>
259 #if TIME_WITH_SYS_TIME
260 diff -r 7cba4201a2ae libgcc/unwind-dw2-fde-dip.c
261 --- a/libgcc/unwind-dw2-fde-dip.c Sat Jul 27 22:53:05 2013 -0400
262 +++ b/libgcc/unwind-dw2-fde-dip.c Sat Jul 27 22:57:08 2013 -0400
263 @@ -46,33 +46,13 @@
264 #include "unwind-compat.h"
265 #include "gthr.h"
267 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
268 - && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
269 - || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
270 +#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
271 # define USE_PT_GNU_EH_FRAME
272 -#endif
274 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
275 - && defined(__BIONIC__)
276 -# define USE_PT_GNU_EH_FRAME
277 -#endif
279 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
280 - && defined(__FreeBSD__) && __FreeBSD__ >= 7
281 -# define ElfW __ElfN
282 -# define USE_PT_GNU_EH_FRAME
283 -#endif
285 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
286 - && defined(__OpenBSD__)
287 -# define ElfW(type) Elf_##type
288 -# define USE_PT_GNU_EH_FRAME
289 -#endif
291 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
292 - && defined(TARGET_DL_ITERATE_PHDR) \
293 - && defined(__sun__) && defined(__svr4__)
294 -# define USE_PT_GNU_EH_FRAME
295 +# ifdef __OpenBSD__
296 +# define ElfW(type) Elf_##typ
297 +# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
298 +# define ElfW __ElfN
299 +# endif
300 #endif
302 #if defined(USE_PT_GNU_EH_FRAME)
303 diff -r 75d9c38318a7 gcc/configure
304 --- a/gcc/configure Tue Sep 24 06:52:49 2013 -0400
305 +++ b/gcc/configure Tue Sep 24 06:54:33 2013 -0400
306 @@ -26736,6 +26736,9 @@
307 else
308 gcc_cv_libc_provides_ssp=no
309 case "$target" in
310 + *-*-musl*)
311 + # All versions of musl provide stack protector
312 + gcc_cv_libc_provides_ssp=yes;;
313 *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
314 # glibc 2.4 and later provides __stack_chk_fail and
315 # either __stack_chk_guard, or TLS access to stack guard canary.
316 @@ -26769,6 +26772,7 @@
317 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
318 # simply assert that glibc does provide this, which is true for all
319 # realistically usable GNU/Hurd configurations.
320 + # All supported versions of musl provide it as well
321 gcc_cv_libc_provides_ssp=yes;;
322 *-*-darwin* | *-*-freebsd*)
323 ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
324 @@ -26851,6 +26855,9 @@
325 gcc_cv_target_dl_iterate_phdr=no
328 + *-linux-musl*)
329 + gcc_cv_target_dl_iterate_phdr=yes
330 + ;;
331 esac
333 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
334 diff -r 75d9c38318a7 gcc/configure.ac
335 --- a/gcc/configure.ac Tue Sep 24 06:52:49 2013 -0400
336 +++ b/gcc/configure.ac Tue Sep 24 06:54:33 2013 -0400
337 @@ -4719,6 +4719,9 @@
338 gcc_cv_libc_provides_ssp,
339 [gcc_cv_libc_provides_ssp=no
340 case "$target" in
341 + *-*-musl*)
342 + # All versions of musl provide stack protector
343 + gcc_cv_libc_provides_ssp=yes;;
344 *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
345 [# glibc 2.4 and later provides __stack_chk_fail and
346 # either __stack_chk_guard, or TLS access to stack guard canary.
347 @@ -4752,6 +4755,7 @@
348 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
349 # simply assert that glibc does provide this, which is true for all
350 # realistically usable GNU/Hurd configurations.
351 + # All supported versions of musl provide it as well
352 gcc_cv_libc_provides_ssp=yes;;
353 *-*-darwin* | *-*-freebsd*)
354 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
355 @@ -4817,6 +4821,9 @@
356 gcc_cv_target_dl_iterate_phdr=no
359 + *-linux-musl*)
360 + gcc_cv_target_dl_iterate_phdr=yes
361 + ;;
362 esac
363 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
364 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
365 # HG changeset patch
366 # Parent 94e435662aff38e86c9ca0dff4bbf451e0190b34
367 Get rid of ever-broken fixincludes on musl.
370 diff -r 94e435662aff -r e27957848dc8 fixincludes/mkfixinc.sh
371 --- a/fixincludes/mkfixinc.sh Sat Jul 27 23:37:20 2013 -0400
372 +++ b/fixincludes/mkfixinc.sh Sat Jul 27 23:43:03 2013 -0400
373 @@ -19,7 +19,8 @@
374 powerpc-*-eabi* | \
375 powerpc-*-rtems* | \
376 powerpcle-*-eabisim* | \
377 - powerpcle-*-eabi* )
378 + powerpcle-*-eabi* | \
379 + *-musl* )
380 # IF there is no include fixing,
381 # THEN create a no-op fixer and exit
382 (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
383 # HG changeset patch
384 # Parent 3ea10cd626cb7abdfd56d3fe8d2c9ed58a82797b
385 Support for i386-linux-musl and x86_64-linux-musl.
387 diff -r 3ea10cd626cb gcc/config/i386/linux.h
388 --- a/gcc/config/i386/linux.h Fri Mar 29 16:41:17 2013 -0400
389 +++ b/gcc/config/i386/linux.h Fri Mar 29 16:41:20 2013 -0400
390 @@ -21,3 +21,4 @@
392 #define GNU_USER_LINK_EMULATION "elf_i386"
393 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
394 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
395 diff -r 3ea10cd626cb gcc/config/i386/linux64.h
396 --- a/gcc/config/i386/linux64.h Fri Mar 29 16:41:17 2013 -0400
397 +++ b/gcc/config/i386/linux64.h Fri Mar 29 16:41:20 2013 -0400
398 @@ -30,3 +30,7 @@
399 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
400 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
401 #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
403 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
404 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
405 +#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
406 diff -r 3ea10cd626cb libitm/config/linux/x86/tls.h
407 --- a/libitm/config/linux/x86/tls.h Fri Mar 29 16:41:17 2013 -0400
408 +++ b/libitm/config/linux/x86/tls.h Fri Mar 29 16:41:20 2013 -0400
409 @@ -25,16 +25,19 @@
410 #ifndef LIBITM_X86_TLS_H
411 #define LIBITM_X86_TLS_H 1
413 -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
414 +#if defined(__GLIBC_PREREQ)
415 +#if __GLIBC_PREREQ(2, 10)
416 /* Use slots in the TCB head rather than __thread lookups.
417 GLIBC has reserved words 10 through 13 for TM. */
418 #define HAVE_ARCH_GTM_THREAD 1
419 #define HAVE_ARCH_GTM_THREAD_DISP 1
420 #endif
421 +#endif
423 #include "config/generic/tls.h"
425 -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
426 +#if defined(__GLIBC_PREREQ)
427 +#if __GLIBC_PREREQ(2, 10)
428 namespace GTM HIDDEN {
430 #ifdef __x86_64__
431 @@ -101,5 +104,6 @@
433 } // namespace GTM
434 #endif /* >= GLIBC 2.10 */
435 +#endif
437 #endif // LIBITM_X86_TLS_H
438 # HG changeset patch
439 # Parent c3eb69047e35491fda9cd9ab1ee2ace1299c793c
440 Support for arm-linux-musl.
442 diff -r c3eb69047e35 gcc/config/arm/linux-eabi.h
443 --- a/gcc/config/arm/linux-eabi.h Thu Sep 19 07:11:38 2013 -0400
444 +++ b/gcc/config/arm/linux-eabi.h Thu Sep 19 08:56:47 2013 -0400
445 @@ -77,6 +77,23 @@
446 %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
447 %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
449 +/* For ARM musl currently supports four dynamic linkers:
450 + - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
451 + - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
452 + - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
453 + - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
454 + musl does not support the legacy OABI mode.
455 + All the dynamic linkers live in /lib.
456 + We default to soft-float, EL. */
457 +#undef MUSL_DYNAMIC_LINKER
458 +#if TARGET_BIG_ENDIAN_DEFAULT
459 +#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
460 +#else
461 +#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
462 +#endif
463 +#define MUSL_DYNAMIC_LINKER \
464 + "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
466 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
467 use the GNU/Linux version, not the generic BPABI version. */
468 #undef LINK_SPEC
469 diff -r c3eb69047e35 libitm/config/arm/hwcap.cc
470 --- a/libitm/config/arm/hwcap.cc Thu Sep 19 07:11:38 2013 -0400
471 +++ b/libitm/config/arm/hwcap.cc Thu Sep 19 08:56:47 2013 -0400
472 @@ -40,7 +40,11 @@
474 #ifdef __linux__
475 #include <unistd.h>
476 +#ifdef __GLIBC__
477 #include <sys/fcntl.h>
478 +#else
479 +#include <fcntl.h>
480 +#endif
481 #include <elf.h>
483 static void __attribute__((constructor))
484 # HG changeset patch
485 # Parent 4618ad6f036f1e944a5262ae5875dcdf62c41f8b
486 Support for mips-linux-musl.
488 diff -r 4618ad6f036f gcc/config/mips/linux.h
489 --- a/gcc/config/mips/linux.h Thu Sep 19 08:56:47 2013 -0400
490 +++ b/gcc/config/mips/linux.h Thu Sep 19 09:08:11 2013 -0400
491 @@ -18,3 +18,10 @@
492 <http://www.gnu.org/licenses/>. */
494 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
496 +#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
497 +#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
498 +#else
499 +#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
500 +#endif
501 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1"
502 # HG changeset patch
503 # Parent 2ffe76b215fdb082cbbc262536077627757fa9bf
504 Support for powerpc-linux-musl.
506 diff -r 2ffe76b215fd gcc/config.gcc
507 --- a/gcc/config.gcc Fri Mar 29 16:41:26 2013 -0400
508 +++ b/gcc/config.gcc Fri Mar 29 16:41:28 2013 -0400
509 @@ -2112,6 +2112,10 @@
510 powerpc*-*-linux*paired*)
511 tm_file="${tm_file} rs6000/750cl.h" ;;
512 esac
513 + case ${target} in
514 + *-linux*-musl*)
515 + enable_secureplt=yes ;;
516 + esac
517 if test x${enable_secureplt} = xyes; then
518 tm_file="rs6000/secureplt.h ${tm_file}"
520 diff -r 2ffe76b215fd gcc/config/rs6000/linux64.h
521 --- a/gcc/config/rs6000/linux64.h Fri Mar 29 16:41:26 2013 -0400
522 +++ b/gcc/config/rs6000/linux64.h Fri Mar 29 16:41:28 2013 -0400
523 @@ -364,17 +364,21 @@
524 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
525 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
526 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
527 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
528 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
529 #if DEFAULT_LIBC == LIBC_UCLIBC
530 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
531 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
532 #elif DEFAULT_LIBC == LIBC_GLIBC
533 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
534 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
535 +#elif DEFAULT_LIBC == LIBC_MUSL
536 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
537 #else
538 #error "Unsupported DEFAULT_LIBC"
539 #endif
540 #define GNU_USER_DYNAMIC_LINKER32 \
541 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
542 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
543 #define GNU_USER_DYNAMIC_LINKER64 \
544 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
545 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
548 #define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
549 diff -r 2ffe76b215fd gcc/config/rs6000/secureplt.h
550 --- a/gcc/config/rs6000/secureplt.h Fri Mar 29 16:41:26 2013 -0400
551 +++ b/gcc/config/rs6000/secureplt.h Fri Mar 29 16:41:28 2013 -0400
552 @@ -18,3 +18,4 @@
553 <http://www.gnu.org/licenses/>. */
555 #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
556 +#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
557 diff -r 2ffe76b215fd gcc/config/rs6000/sysv4.h
558 --- a/gcc/config/rs6000/sysv4.h Fri Mar 29 16:41:26 2013 -0400
559 +++ b/gcc/config/rs6000/sysv4.h Fri Mar 29 16:41:28 2013 -0400
560 @@ -551,6 +551,9 @@
561 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
562 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
563 #endif
564 +#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
565 +#define LINK_SECURE_PLT_DEFAULT_SPEC ""
566 +#endif
568 /* Pass -G xxx to the compiler and set correct endian mode. */
569 #define CC1_SPEC "%{G*} %(cc1_cpu) \
570 @@ -611,7 +614,8 @@
571 %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
572 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
573 %{mcall-i960-old: --oformat elf32-powerpcle} \
574 - }}}}"
575 + }}}} \
576 +%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
578 /* Any specific OS flags. */
579 #define LINK_OS_SPEC "\
580 @@ -789,15 +793,18 @@
582 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
583 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
584 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
585 #if DEFAULT_LIBC == LIBC_UCLIBC
586 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
587 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
588 +#elif DEFAULT_LIBC == LIBC_MUSL
589 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
590 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
591 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
592 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
593 #else
594 #error "Unsupported DEFAULT_LIBC"
595 #endif
596 #define GNU_USER_DYNAMIC_LINKER \
597 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
598 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
600 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
601 %{rdynamic:-export-dynamic} \
602 @@ -923,6 +930,7 @@
603 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
604 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
605 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
606 + { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
607 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
608 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
609 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
610 --- a/gcc/config/aarch64/aarch64-linux.h 2013-01-10 21:38:27.000000000 +0100
611 +++ b/gcc/config/aarch64/aarch64-linux.h 2013-09-12 21:39:34.004829498 +0200
612 @@ -21,7 +21,11 @@
613 #ifndef GCC_AARCH64_LINUX_H
614 #define GCC_AARCH64_LINUX_H
616 +/* The AArch64 port currently supports two dynamic linkers:
617 + - ld-linux-aarch64.so.1 - GLIBC dynamic linker
618 + - ld-musl-aarch64.so.1 - musl libc dynamic linker */
619 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64.so.1"
620 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64.so.1"
622 #define LINUX_TARGET_LINK_SPEC "%{h*} \
623 %{static:-Bstatic} \