fix GMP base URL
[rofl0r-mmix-cross.git] / patches / gcc-4.9.3-musl.diff
blobf4a68f7fa23a8d3fa59f2cbec842c1743ffcf9d5
1 # HG changeset patch
2 # Parent 889b7d97216603795ba8c5f4da8e616bef8feb9d
3 Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
5 diff -r 889b7d972166 libstdc++-v3/configure.host
6 --- a/libstdc++-v3/configure.host Sun Jul 26 15:30:11 2015 -0400
7 +++ b/libstdc++-v3/configure.host Sun Jul 26 15:32:09 2015 -0400
8 @@ -266,6 +266,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 @@ -274,6 +281,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 fef9a6ed009159f294d8524a0bc1dda731990754
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 fef9a6ed0091 gcc/config.gcc
37 --- a/gcc/config.gcc Sun Jul 26 15:32:09 2015 -0400
38 +++ b/gcc/config.gcc Sun Jul 26 15:32:11 2015 -0400
39 @@ -594,7 +594,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 # 32-bit x86 processors supported by --with-arch=. Each processor
47 # MUST be separated by exactly one space.
48 @@ -719,6 +719,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 fef9a6ed0091 gcc/config/linux.h
59 --- a/gcc/config/linux.h Sun Jul 26 15:32:09 2015 -0400
60 +++ b/gcc/config/linux.h Sun Jul 26 15:32:11 2015 -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,92 @@
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 /* Whether we have Bionic libc runtime */
124 #undef TARGET_HAS_BIONIC
125 #define TARGET_HAS_BIONIC (OPTION_BIONIC)
127 +/* musl avoids problematic includes by rearranging the include directories.
128 + * Unfortunately, this is mostly duplicated from cppdefault.c */
129 +#if DEFAULT_LIBC == LIBC_MUSL
130 +#define INCLUDE_DEFAULTS_MUSL_GPP \
131 + { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
132 + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
133 + { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
134 + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
135 + { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
136 + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
138 +#ifdef LOCAL_INCLUDE_DIR
139 +#define INCLUDE_DEFAULTS_MUSL_LOCAL \
140 + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
141 + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
142 +#else
143 +#define INCLUDE_DEFAULTS_MUSL_LOCAL
144 +#endif
146 +#ifdef PREFIX_INCLUDE_DIR
147 +#define INCLUDE_DEFAULTS_MUSL_PREFIX \
148 + { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
149 +#else
150 +#define INCLUDE_DEFAULTS_MUSL_PREFIX
151 +#endif
153 +#ifdef CROSS_INCLUDE_DIR
154 +#define INCLUDE_DEFAULTS_MUSL_CROSS \
155 + { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
156 +#else
157 +#define INCLUDE_DEFAULTS_MUSL_CROSS
158 +#endif
160 +#ifdef TOOL_INCLUDE_DIR
161 +#define INCLUDE_DEFAULTS_MUSL_TOOL \
162 + { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
163 +#else
164 +#define INCLUDE_DEFAULTS_MUSL_TOOL
165 +#endif
167 +#ifdef NATIVE_SYSTEM_HEADER_DIR
168 +#define INCLUDE_DEFAULTS_MUSL_NATIVE \
169 + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
170 + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
171 +#else
172 +#define INCLUDE_DEFAULTS_MUSL_NATIVE
173 +#endif
175 +#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
176 +# undef INCLUDE_DEFAULTS_MUSL_LOCAL
177 +# define INCLUDE_DEFAULTS_MUSL_LOCAL
178 +# undef INCLUDE_DEFAULTS_MUSL_NATIVE
179 +# define INCLUDE_DEFAULTS_MUSL_NATIVE
180 +#else
181 +# undef INCLUDE_DEFAULTS_MUSL_CROSS
182 +# define INCLUDE_DEFAULTS_MUSL_CROSS
183 +#endif
185 +#undef INCLUDE_DEFAULTS
186 +#define INCLUDE_DEFAULTS \
187 + { \
188 + INCLUDE_DEFAULTS_MUSL_GPP \
189 + INCLUDE_DEFAULTS_MUSL_PREFIX \
190 + INCLUDE_DEFAULTS_MUSL_CROSS \
191 + INCLUDE_DEFAULTS_MUSL_TOOL \
192 + INCLUDE_DEFAULTS_MUSL_NATIVE \
193 + { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
194 + { 0, 0, 0, 0, 0, 0 } \
196 +#endif
198 #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
199 /* This is a *uclinux* target. We don't define below macros to normal linux
200 versions, because doing so would require *uclinux* targets to include
201 diff -r fef9a6ed0091 gcc/config/linux.opt
202 --- a/gcc/config/linux.opt Sun Jul 26 15:32:09 2015 -0400
203 +++ b/gcc/config/linux.opt Sun Jul 26 15:32:11 2015 -0400
204 @@ -30,3 +30,7 @@
205 muclibc
206 Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
207 Use uClibc C library
209 +mmusl
210 +Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
211 +Use musl C library
212 diff -r fef9a6ed0091 gcc/ginclude/stddef.h
213 --- a/gcc/ginclude/stddef.h Sun Jul 26 15:32:09 2015 -0400
214 +++ b/gcc/ginclude/stddef.h Sun Jul 26 15:32:11 2015 -0400
215 @@ -181,6 +181,7 @@
216 #ifndef _GCC_SIZE_T
217 #ifndef _SIZET_
218 #ifndef __size_t
219 +#ifndef __DEFINED_size_t /* musl */
220 #define __size_t__ /* BeOS */
221 #define __SIZE_T__ /* Cray Unicos/Mk */
222 #define _SIZE_T
223 @@ -197,6 +198,7 @@
224 #define ___int_size_t_h
225 #define _GCC_SIZE_T
226 #define _SIZET_
227 +#define __DEFINED_size_t /* musl */
228 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
229 || defined(__FreeBSD_kernel__)
230 /* __size_t is a typedef on FreeBSD 5, must not trash it. */
231 @@ -214,6 +216,7 @@
232 typedef long ssize_t;
233 #endif /* __BEOS__ */
234 #endif /* !(defined (__GNUG__) && defined (size_t)) */
235 +#endif /* __DEFINED_size_t */
236 #endif /* __size_t */
237 #endif /* _SIZET_ */
238 #endif /* _GCC_SIZE_T */
239 # HG changeset patch
240 # Parent 47dcb1f7b3a9c1b5d6b9d56303e7603fbe5a51f9
241 A fix for libgomp to correctly request a POSIX version for time support.
243 diff -r 47dcb1f7b3a9 libgomp/config/posix/time.c
244 --- a/libgomp/config/posix/time.c Sun Jul 26 15:32:11 2015 -0400
245 +++ b/libgomp/config/posix/time.c Sun Jul 26 15:32:13 2015 -0400
246 @@ -28,6 +28,8 @@
247 The following implementation uses the most simple POSIX routines.
248 If present, POSIX 4 clocks should be used instead. */
250 +#define _POSIX_C_SOURCE 199309L /* for clocks */
252 #include "libgomp.h"
253 #include <unistd.h>
254 #if TIME_WITH_SYS_TIME
255 diff -r ddc4b4034e51 libgcc/unwind-dw2-fde-dip.c
256 --- a/libgcc/unwind-dw2-fde-dip.c Sun Jul 26 15:32:13 2015 -0400
257 +++ b/libgcc/unwind-dw2-fde-dip.c Sun Jul 26 15:32:15 2015 -0400
258 @@ -46,33 +46,13 @@
259 #include "unwind-compat.h"
260 #include "gthr.h"
262 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
263 - && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
264 - || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
265 +#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
266 # define USE_PT_GNU_EH_FRAME
267 -#endif
269 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
270 - && defined(__BIONIC__)
271 -# define USE_PT_GNU_EH_FRAME
272 -#endif
274 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
275 - && defined(__FreeBSD__) && __FreeBSD__ >= 7
276 -# define ElfW __ElfN
277 -# define USE_PT_GNU_EH_FRAME
278 -#endif
280 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
281 - && defined(__OpenBSD__)
282 -# define ElfW(type) Elf_##type
283 -# define USE_PT_GNU_EH_FRAME
284 -#endif
286 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
287 - && defined(TARGET_DL_ITERATE_PHDR) \
288 - && defined(__sun__) && defined(__svr4__)
289 -# define USE_PT_GNU_EH_FRAME
290 +# ifdef __OpenBSD__
291 +# define ElfW(type) Elf_##type
292 +# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
293 +# define ElfW __ElfN
294 +# endif
295 #endif
297 #if defined(USE_PT_GNU_EH_FRAME)
298 diff -r 3baeaed6c155 gcc/configure
299 --- a/gcc/configure Sun Jul 26 15:32:15 2015 -0400
300 +++ b/gcc/configure Sun Jul 26 15:32:17 2015 -0400
301 @@ -27449,6 +27449,9 @@
302 else
303 gcc_cv_libc_provides_ssp=no
304 case "$target" in
305 + *-*-musl*)
306 + # All versions of musl provide stack protector
307 + gcc_cv_libc_provides_ssp=yes;;
308 *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
309 # glibc 2.4 and later provides __stack_chk_fail and
310 # either __stack_chk_guard, or TLS access to stack guard canary.
311 @@ -27481,6 +27484,7 @@
312 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
313 # simply assert that glibc does provide this, which is true for all
314 # realistically usable GNU/Hurd configurations.
315 + # All supported versions of musl provide it as well
316 gcc_cv_libc_provides_ssp=yes;;
317 *-*-darwin* | *-*-freebsd*)
318 ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
319 @@ -27570,6 +27574,9 @@
320 gcc_cv_target_dl_iterate_phdr=no
323 + *-linux-musl*)
324 + gcc_cv_target_dl_iterate_phdr=yes
325 + ;;
326 esac
328 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
329 diff -r 3baeaed6c155 gcc/configure.ac
330 --- a/gcc/configure.ac Sun Jul 26 15:32:15 2015 -0400
331 +++ b/gcc/configure.ac Sun Jul 26 15:32:17 2015 -0400
332 @@ -5076,6 +5076,9 @@
333 gcc_cv_libc_provides_ssp,
334 [gcc_cv_libc_provides_ssp=no
335 case "$target" in
336 + *-*-musl*)
337 + # All versions of musl provide stack protector
338 + gcc_cv_libc_provides_ssp=yes;;
339 *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
340 # glibc 2.4 and later provides __stack_chk_fail and
341 # either __stack_chk_guard, or TLS access to stack guard canary.
342 @@ -5102,6 +5105,7 @@
343 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
344 # simply assert that glibc does provide this, which is true for all
345 # realistically usable GNU/Hurd configurations.
346 + # All supported versions of musl provide it as well
347 gcc_cv_libc_provides_ssp=yes;;
348 *-*-darwin* | *-*-freebsd*)
349 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
350 @@ -5168,6 +5172,9 @@
351 gcc_cv_target_dl_iterate_phdr=no
354 + *-linux-musl*)
355 + gcc_cv_target_dl_iterate_phdr=yes
356 + ;;
357 esac
358 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
359 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
360 diff -r 581c4dd64733 gcc/gcc.c
361 --- a/gcc/gcc.c Sun Jul 26 15:32:17 2015 -0400
362 +++ b/gcc/gcc.c Sun Jul 26 15:32:19 2015 -0400
363 @@ -670,7 +670,7 @@
365 #ifndef LINK_SSP_SPEC
366 #ifdef TARGET_LIBC_PROVIDES_SSP
367 -#define LINK_SSP_SPEC "%{fstack-protector:}"
368 +#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared}"
369 #else
370 #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-strong|fstack-protector-all:-lssp_nonshared -lssp}"
371 #endif
372 # HG changeset patch
373 # Parent 9f2f4e02fced4d4810910db6cced26ed0d47c23f
374 Get rid of ever-broken fixincludes on musl.
376 diff -r 9f2f4e02fced fixincludes/mkfixinc.sh
377 --- a/fixincludes/mkfixinc.sh Sun Jul 26 15:32:19 2015 -0400
378 +++ b/fixincludes/mkfixinc.sh Sun Jul 26 15:32:21 2015 -0400
379 @@ -19,7 +19,8 @@
380 powerpc-*-eabi* | \
381 powerpc-*-rtems* | \
382 powerpcle-*-eabisim* | \
383 - powerpcle-*-eabi* )
384 + powerpcle-*-eabi* | \
385 + *-musl* )
386 # IF there is no include fixing,
387 # THEN create a no-op fixer and exit
388 (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
389 # HG changeset patch
390 # Parent ab9383ed51ae0c261e0c860fc6b953eb57976eef
391 Support for i386-linux-musl and x86_64-linux-musl.
393 diff -r ab9383ed51ae gcc/config/i386/linux.h
394 --- a/gcc/config/i386/linux.h Sun Jul 26 15:32:21 2015 -0400
395 +++ b/gcc/config/i386/linux.h Sun Jul 26 15:32:23 2015 -0400
396 @@ -21,3 +21,4 @@
398 #define GNU_USER_LINK_EMULATION "elf_i386"
399 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
400 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
401 diff -r ab9383ed51ae gcc/config/i386/linux64.h
402 --- a/gcc/config/i386/linux64.h Sun Jul 26 15:32:21 2015 -0400
403 +++ b/gcc/config/i386/linux64.h Sun Jul 26 15:32:23 2015 -0400
404 @@ -30,3 +30,7 @@
405 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
406 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
407 #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
409 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
410 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
411 +#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
412 diff -r ab9383ed51ae libitm/config/linux/x86/tls.h
413 --- a/libitm/config/linux/x86/tls.h Sun Jul 26 15:32:21 2015 -0400
414 +++ b/libitm/config/linux/x86/tls.h Sun Jul 26 15:32:23 2015 -0400
415 @@ -25,16 +25,19 @@
416 #ifndef LIBITM_X86_TLS_H
417 #define LIBITM_X86_TLS_H 1
419 -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
420 +#if defined(__GLIBC_PREREQ)
421 +#if __GLIBC_PREREQ(2, 10)
422 /* Use slots in the TCB head rather than __thread lookups.
423 GLIBC has reserved words 10 through 13 for TM. */
424 #define HAVE_ARCH_GTM_THREAD 1
425 #define HAVE_ARCH_GTM_THREAD_DISP 1
426 #endif
427 +#endif
429 #include "config/generic/tls.h"
431 -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
432 +#if defined(__GLIBC_PREREQ)
433 +#if __GLIBC_PREREQ(2, 10)
434 namespace GTM HIDDEN {
436 #ifdef __x86_64__
437 @@ -101,5 +104,6 @@
439 } // namespace GTM
440 #endif /* >= GLIBC 2.10 */
441 +#endif
443 #endif // LIBITM_X86_TLS_H
444 # HG changeset patch
445 # Parent 92d83561106d17ca896328fcb4ec36cd4e2e9e16
446 Support for arm-linux-musl.
448 diff -r 92d83561106d gcc/config/arm/linux-eabi.h
449 --- a/gcc/config/arm/linux-eabi.h Sun Jul 26 15:32:23 2015 -0400
450 +++ b/gcc/config/arm/linux-eabi.h Sun Jul 26 15:32:25 2015 -0400
451 @@ -77,6 +77,23 @@
452 %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
453 %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
455 +/* For ARM musl currently supports four dynamic linkers:
456 + - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
457 + - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
458 + - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
459 + - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
460 + musl does not support the legacy OABI mode.
461 + All the dynamic linkers live in /lib.
462 + We default to soft-float, EL. */
463 +#undef MUSL_DYNAMIC_LINKER
464 +#if TARGET_BIG_ENDIAN_DEFAULT
465 +#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
466 +#else
467 +#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
468 +#endif
469 +#define MUSL_DYNAMIC_LINKER \
470 + "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
472 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
473 use the GNU/Linux version, not the generic BPABI version. */
474 #undef LINK_SPEC
475 diff -r 92d83561106d libitm/config/arm/hwcap.cc
476 --- a/libitm/config/arm/hwcap.cc Sun Jul 26 15:32:23 2015 -0400
477 +++ b/libitm/config/arm/hwcap.cc Sun Jul 26 15:32:25 2015 -0400
478 @@ -40,7 +40,11 @@
480 #ifdef __linux__
481 #include <unistd.h>
482 +#ifdef __GLIBC__
483 #include <sys/fcntl.h>
484 +#else
485 +#include <fcntl.h>
486 +#endif
487 #include <elf.h>
489 static void __attribute__((constructor))
490 # HG changeset patch
491 # Parent 270d6afd029dd396b69553e1d96f35d2ebdd2f99
492 Support for mips-linux-musl.
494 diff -r 270d6afd029d gcc/config/mips/linux.h
495 --- a/gcc/config/mips/linux.h Sun Jul 26 15:32:25 2015 -0400
496 +++ b/gcc/config/mips/linux.h Sun Jul 26 15:32:26 2015 -0400
497 @@ -23,3 +23,10 @@
498 #undef UCLIBC_DYNAMIC_LINKER
499 #define UCLIBC_DYNAMIC_LINKER \
500 "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
502 +#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
503 +#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
504 +#else
505 +#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
506 +#endif
507 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
508 # HG changeset patch
509 # Parent 3974ad9269f7e4c5605e0bb38db7418a69e6ee95
510 Support for powerpc-linux-musl.
512 diff -r 3974ad9269f7 gcc/config.gcc
513 --- a/gcc/config.gcc Sun Jul 26 15:32:26 2015 -0400
514 +++ b/gcc/config.gcc Sun Jul 26 15:32:28 2015 -0400
515 @@ -2344,6 +2344,10 @@
516 powerpc*-*-linux*paired*)
517 tm_file="${tm_file} rs6000/750cl.h" ;;
518 esac
519 + case ${target} in
520 + *-linux*-musl*)
521 + enable_secureplt=yes ;;
522 + esac
523 if test x${enable_secureplt} = xyes; then
524 tm_file="rs6000/secureplt.h ${tm_file}"
526 diff -r 3974ad9269f7 gcc/config/rs6000/linux64.h
527 --- a/gcc/config/rs6000/linux64.h Sun Jul 26 15:32:26 2015 -0400
528 +++ b/gcc/config/rs6000/linux64.h Sun Jul 26 15:32:28 2015 -0400
529 @@ -371,17 +371,21 @@
530 #endif
531 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
532 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
533 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
534 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
535 #if DEFAULT_LIBC == LIBC_UCLIBC
536 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
537 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
538 #elif DEFAULT_LIBC == LIBC_GLIBC
539 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
540 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
541 +#elif DEFAULT_LIBC == LIBC_MUSL
542 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
543 #else
544 #error "Unsupported DEFAULT_LIBC"
545 #endif
546 #define GNU_USER_DYNAMIC_LINKER32 \
547 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
548 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
549 #define GNU_USER_DYNAMIC_LINKER64 \
550 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
551 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
553 #undef DEFAULT_ASM_ENDIAN
554 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
555 diff -r 3974ad9269f7 gcc/config/rs6000/secureplt.h
556 --- a/gcc/config/rs6000/secureplt.h Sun Jul 26 15:32:26 2015 -0400
557 +++ b/gcc/config/rs6000/secureplt.h Sun Jul 26 15:32:28 2015 -0400
558 @@ -18,3 +18,4 @@
559 <http://www.gnu.org/licenses/>. */
561 #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
562 +#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
563 diff -r 3974ad9269f7 gcc/config/rs6000/sysv4.h
564 --- a/gcc/config/rs6000/sysv4.h Sun Jul 26 15:32:26 2015 -0400
565 +++ b/gcc/config/rs6000/sysv4.h Sun Jul 26 15:32:28 2015 -0400
566 @@ -537,6 +537,9 @@
567 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
568 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
569 #endif
570 +#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
571 +#define LINK_SECURE_PLT_DEFAULT_SPEC ""
572 +#endif
574 /* Pass -G xxx to the compiler. */
575 #define CC1_SPEC "%{G*} %(cc1_cpu)" \
576 @@ -585,7 +588,8 @@
578 /* Override the default target of the linker. */
579 #define LINK_TARGET_SPEC \
580 - ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
581 + ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
582 + "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
584 /* Any specific OS flags. */
585 #define LINK_OS_SPEC "\
586 @@ -763,15 +767,18 @@
588 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
589 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
590 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
591 #if DEFAULT_LIBC == LIBC_UCLIBC
592 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
593 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
594 +#elif DEFAULT_LIBC == LIBC_MUSL
595 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
596 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
597 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
598 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
599 #else
600 #error "Unsupported DEFAULT_LIBC"
601 #endif
602 #define GNU_USER_DYNAMIC_LINKER \
603 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
604 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
606 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
607 %{rdynamic:-export-dynamic} \
608 @@ -894,6 +901,7 @@
609 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
610 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
611 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
612 + { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
613 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
614 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
615 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
616 diff -r 7c6d89fb1832 gcc/config/aarch64/aarch64-linux.h
617 --- a/gcc/config/aarch64/aarch64-linux.h Sun Jul 26 15:32:28 2015 -0400
618 +++ b/gcc/config/aarch64/aarch64-linux.h Sun Jul 26 15:32:30 2015 -0400
619 @@ -23,6 +23,8 @@
621 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}.so.1"
623 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64.so.1"
625 #define CPP_SPEC "%{pthread:-D_REENTRANT}"
627 #define LINUX_TARGET_LINK_SPEC "%{h*} \
628 # HG changeset patch
629 # Parent d548cc2d1cfea3241205efc347caec8ad78c21d4
630 Microblaze support (again).
632 diff -r d548cc2d1cfe gcc/config/microblaze/linux.h
633 --- a/gcc/config/microblaze/linux.h Sun Jul 26 15:32:30 2015 -0400
634 +++ b/gcc/config/microblaze/linux.h Sun Jul 26 15:32:32 2015 -0400
635 @@ -28,7 +28,22 @@
636 #undef TLS_NEEDS_GOT
637 #define TLS_NEEDS_GOT 1
639 -#define DYNAMIC_LINKER "/lib/ld.so.1"
640 +#if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */
641 +#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
642 +#else
643 +#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
644 +#endif
646 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
647 +#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
649 +#if DEFAULT_LIBC == LIBC_MUSL
650 +#define DYNAMIC_LINKER MUSL_DYNAMIC_LINKER
651 +#else
652 +#define DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
653 +#endif
656 #undef SUBTARGET_EXTRA_SPECS
657 #define SUBTARGET_EXTRA_SPECS \
658 { "dynamic_linker", DYNAMIC_LINKER }
659 From 478ee0c03a08e2ef9371fd88d516738936943e78 Mon Sep 17 00:00:00 2001
660 From: David Holsgrove <david.holsgrove@xilinx.com>
661 Date: Fri, 28 Sep 2012 16:32:03 +1000
662 Subject: [PATCH 06/11] [Patch, microblaze]: Add SIZE_TYPE and PTRDIFF_TYPE to
663 microblaze.h
665 Fixes warnings like;
667 warning: format '%zX' expects argument of type 'size_t',
668 but argument 3 has type 'unsigned int' [-Wformat]
670 Changelog
672 2013-03-18 David Holsgrove <david.holsgrove@xilinx.com>
674 * gcc/config/microblaze/microblaze.h: Define SIZE_TYPE
675 and PTRDIFF_TYPE.
677 Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
679 gcc/config/microblaze/microblaze.h | 6 ++++++
680 1 file changed, 6 insertions(+)
682 diff -r 97f8346ce240 gcc/config/microblaze/microblaze.h
683 --- a/gcc/config/microblaze/microblaze.h Sun Jul 26 15:32:32 2015 -0400
684 +++ b/gcc/config/microblaze/microblaze.h Sun Jul 26 15:32:34 2015 -0400
685 @@ -218,6 +218,12 @@
686 #undef PTRDIFF_TYPE
687 #define PTRDIFF_TYPE "int"
689 +#undef SIZE_TYPE
690 +#define SIZE_TYPE "unsigned int"
692 +#undef PTRDIFF_TYPE
693 +#define PTRDIFF_TYPE "int"
695 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
696 ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \
697 && (ALIGN) < BITS_PER_WORD \
698 diff -r c5b39ce7672b gcc/config/sh/linux.h
699 --- a/gcc/config/sh/linux.h Fri Sep 28 16:32:03 2012 +1000
700 +++ b/gcc/config/sh/linux.h Sun Jul 26 15:32:36 2015 -0400
701 @@ -43,7 +43,14 @@
703 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
705 +#if TARGET_BIG_ENDIAN_DEFAULT /* BE */
706 +#define MUSL_DYNAMIC_LINKER_E "eb"
707 +#else
708 +#define MUSL_DYNAMIC_LINKER_E
709 +#endif
711 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
712 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E ".so.1"
714 #undef SUBTARGET_LINK_EMUL_SUFFIX
715 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
716 Do not use weak references on any targets for gthread. Necessary on musl, safe elsewhere.
718 diff -r d2b373a6ad39 libgcc/gthr.h
719 --- a/libgcc/gthr.h Thu Jan 29 18:59:33 2015 -0500
720 +++ b/libgcc/gthr.h Thu Jan 29 19:00:03 2015 -0500
721 @@ -136,10 +136,8 @@
722 /* The pe-coff weak support isn't fully compatible to ELF's weak.
723 For static libraries it might would work, but as we need to deal
724 with shared versions too, we disable it for mingw-targets. */
725 -#ifdef __MINGW32__
726 #undef GTHREAD_USE_WEAK
727 #define GTHREAD_USE_WEAK 0
728 -#endif
730 #ifndef GTHREAD_USE_WEAK
731 #define GTHREAD_USE_WEAK 1