fix GMP base URL
[rofl0r-mmix-cross.git] / patches / gcc-5.2.0-musl.diff
blob5392b0d3d566cd96a01400d3964b032403815746
1 # HG changeset patch
2 # Parent 9b5795e98965ab4820a65ceeae0de644d0c5a9bb
3 Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
5 diff -r 9b5795e98965 libstdc++-v3/configure.host
6 --- a/libstdc++-v3/configure.host Sun Jul 26 15:42:47 2015 -0400
7 +++ b/libstdc++-v3/configure.host Sun Jul 26 15:46:09 2015 -0400
8 @@ -274,6 +274,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 @@ -282,6 +289,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 698e2b270f3f50fc0036f507a7926e4d68d47be0
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 698e2b270f3f gcc/config.gcc
37 --- a/gcc/config.gcc Sun Jul 26 15:46:09 2015 -0400
38 +++ b/gcc/config.gcc Sun Jul 26 15:46:11 2015 -0400
39 @@ -575,7 +575,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 @@ -720,6 +720,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 698e2b270f3f gcc/config/linux.h
59 --- a/gcc/config/linux.h Sun Jul 26 15:46:09 2015 -0400
60 +++ b/gcc/config/linux.h Sun Jul 26 15:46: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 698e2b270f3f gcc/config/linux.opt
202 --- a/gcc/config/linux.opt Sun Jul 26 15:46:09 2015 -0400
203 +++ b/gcc/config/linux.opt Sun Jul 26 15:46: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 698e2b270f3f gcc/ginclude/stddef.h
213 --- a/gcc/ginclude/stddef.h Sun Jul 26 15:46:09 2015 -0400
214 +++ b/gcc/ginclude/stddef.h Sun Jul 26 15:46:11 2015 -0400
215 @@ -184,6 +184,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 @@ -200,6 +201,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(__DragonFly__) \
230 || defined(__FreeBSD_kernel__)
231 @@ -218,6 +220,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 8d7ec347907e575fb2ec5231262dc39a226cec85
241 A fix for libgomp to correctly request a POSIX version for time support.
243 diff -r 8d7ec347907e libgomp/config/posix/time.c
244 --- a/libgomp/config/posix/time.c Sun Jul 26 15:46:11 2015 -0400
245 +++ b/libgomp/config/posix/time.c Sun Jul 26 15:46:13 2015 -0400
246 @@ -29,6 +29,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 9c90643665ae libgcc/unwind-dw2-fde-dip.c
256 --- a/libgcc/unwind-dw2-fde-dip.c Sun Jul 26 15:46:13 2015 -0400
257 +++ b/libgcc/unwind-dw2-fde-dip.c Sun Jul 26 15:46:15 2015 -0400
258 @@ -46,6 +46,10 @@
259 #include "unwind-compat.h"
260 #include "gthr.h"
262 +#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
263 +# define USE_PT_GNU_EH_FRAME
264 +#endif
266 #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
267 && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
268 || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
269 diff -r 0fe1d86c73d6 gcc/configure
270 --- a/gcc/configure Sun Jul 26 15:46:15 2015 -0400
271 +++ b/gcc/configure Sun Jul 26 15:46:17 2015 -0400
272 @@ -27742,6 +27742,9 @@
273 else
274 gcc_cv_libc_provides_ssp=no
275 case "$target" in
276 + *-*-musl*)
277 + # All versions of musl provide stack protector
278 + gcc_cv_libc_provides_ssp=yes;;
279 *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
280 # glibc 2.4 and later provides __stack_chk_fail and
281 # either __stack_chk_guard, or TLS access to stack guard canary.
282 @@ -27774,6 +27777,7 @@
283 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
284 # simply assert that glibc does provide this, which is true for all
285 # realistically usable GNU/Hurd configurations.
286 + # All supported versions of musl provide it as well
287 gcc_cv_libc_provides_ssp=yes;;
288 *-*-darwin* | *-*-freebsd*)
289 ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
290 @@ -27870,6 +27874,9 @@
291 gcc_cv_target_dl_iterate_phdr=no
294 + *-linux-musl*)
295 + gcc_cv_target_dl_iterate_phdr=yes
296 + ;;
297 esac
299 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
300 diff -r 0fe1d86c73d6 gcc/configure.ac
301 --- a/gcc/configure.ac Sun Jul 26 15:46:15 2015 -0400
302 +++ b/gcc/configure.ac Sun Jul 26 15:46:17 2015 -0400
303 @@ -5229,6 +5229,9 @@
304 gcc_cv_libc_provides_ssp,
305 [gcc_cv_libc_provides_ssp=no
306 case "$target" in
307 + *-*-musl*)
308 + # All versions of musl provide stack protector
309 + gcc_cv_libc_provides_ssp=yes;;
310 *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
311 # glibc 2.4 and later provides __stack_chk_fail and
312 # either __stack_chk_guard, or TLS access to stack guard canary.
313 @@ -5255,6 +5258,7 @@
314 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
315 # simply assert that glibc does provide this, which is true for all
316 # realistically usable GNU/Hurd configurations.
317 + # All supported versions of musl provide it as well
318 gcc_cv_libc_provides_ssp=yes;;
319 *-*-darwin* | *-*-freebsd*)
320 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
321 @@ -5328,6 +5332,9 @@
322 gcc_cv_target_dl_iterate_phdr=no
325 + *-linux-musl*)
326 + gcc_cv_target_dl_iterate_phdr=yes
327 + ;;
328 esac
329 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
330 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
331 diff -r ec6a0ac94411 gcc/gcc.c
332 --- a/gcc/gcc.c Sun Jul 26 15:46:17 2015 -0400
333 +++ b/gcc/gcc.c Sun Jul 26 15:46:19 2015 -0400
334 @@ -729,7 +729,7 @@
335 #ifndef LINK_SSP_SPEC
336 #ifdef TARGET_LIBC_PROVIDES_SSP
337 #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
338 - "|fstack-protector-strong|fstack-protector-explicit:}"
339 + "|fstack-protector-strong|fstack-protector-explicit:-lssp_nonshared}"
340 #else
341 #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
342 "|fstack-protector-strong|fstack-protector-explicit" \
343 # HG changeset patch
344 # Parent e5ca78175ea789ef9eba70ef090abdacd1975224
345 Get rid of ever-broken fixincludes on musl.
347 diff -r e5ca78175ea7 fixincludes/mkfixinc.sh
348 --- a/fixincludes/mkfixinc.sh Sun Jul 26 15:46:19 2015 -0400
349 +++ b/fixincludes/mkfixinc.sh Sun Jul 26 15:46:21 2015 -0400
350 @@ -19,7 +19,8 @@
351 powerpc-*-eabi* | \
352 powerpc-*-rtems* | \
353 powerpcle-*-eabisim* | \
354 - powerpcle-*-eabi* )
355 + powerpcle-*-eabi* | \
356 + *-musl* )
357 # IF there is no include fixing,
358 # THEN create a no-op fixer and exit
359 (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
360 # HG changeset patch
361 # Parent 36af6268b2f02afd6e00a03c100dd0a8d9e3dbe6
362 Support for i386-linux-musl and x86_64-linux-musl.
364 diff -r 36af6268b2f0 gcc/config/i386/linux.h
365 --- a/gcc/config/i386/linux.h Sun Jul 26 15:46:21 2015 -0400
366 +++ b/gcc/config/i386/linux.h Sun Jul 26 15:46:23 2015 -0400
367 @@ -21,3 +21,4 @@
369 #define GNU_USER_LINK_EMULATION "elf_i386"
370 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
371 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
372 diff -r 36af6268b2f0 gcc/config/i386/linux64.h
373 --- a/gcc/config/i386/linux64.h Sun Jul 26 15:46:21 2015 -0400
374 +++ b/gcc/config/i386/linux64.h Sun Jul 26 15:46:23 2015 -0400
375 @@ -30,3 +30,7 @@
376 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
377 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
378 #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
380 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
381 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
382 +#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
383 diff -r 36af6268b2f0 libitm/config/linux/x86/tls.h
384 --- a/libitm/config/linux/x86/tls.h Sun Jul 26 15:46:21 2015 -0400
385 +++ b/libitm/config/linux/x86/tls.h Sun Jul 26 15:46:23 2015 -0400
386 @@ -25,16 +25,19 @@
387 #ifndef LIBITM_X86_TLS_H
388 #define LIBITM_X86_TLS_H 1
390 -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
391 +#if defined(__GLIBC_PREREQ)
392 +#if __GLIBC_PREREQ(2, 10)
393 /* Use slots in the TCB head rather than __thread lookups.
394 GLIBC has reserved words 10 through 13 for TM. */
395 #define HAVE_ARCH_GTM_THREAD 1
396 #define HAVE_ARCH_GTM_THREAD_DISP 1
397 #endif
398 +#endif
400 #include "config/generic/tls.h"
402 -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
403 +#if defined(__GLIBC_PREREQ)
404 +#if __GLIBC_PREREQ(2, 10)
405 namespace GTM HIDDEN {
407 #ifdef __x86_64__
408 @@ -101,5 +104,6 @@
410 } // namespace GTM
411 #endif /* >= GLIBC 2.10 */
412 +#endif
414 #endif // LIBITM_X86_TLS_H
415 # HG changeset patch
416 # Parent 214669757bc7960ef2132bcc15302c4a8de0f35a
417 Support for arm-linux-musl.
419 diff -r 214669757bc7 gcc/config/arm/linux-eabi.h
420 --- a/gcc/config/arm/linux-eabi.h Sun Jul 26 15:46:23 2015 -0400
421 +++ b/gcc/config/arm/linux-eabi.h Sun Jul 26 15:46:25 2015 -0400
422 @@ -77,6 +77,23 @@
423 %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
424 %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
426 +/* For ARM musl currently supports four dynamic linkers:
427 + - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
428 + - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
429 + - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
430 + - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
431 + musl does not support the legacy OABI mode.
432 + All the dynamic linkers live in /lib.
433 + We default to soft-float, EL. */
434 +#undef MUSL_DYNAMIC_LINKER
435 +#if TARGET_BIG_ENDIAN_DEFAULT
436 +#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
437 +#else
438 +#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
439 +#endif
440 +#define MUSL_DYNAMIC_LINKER \
441 + "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
443 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
444 use the GNU/Linux version, not the generic BPABI version. */
445 #undef LINK_SPEC
446 diff -r 214669757bc7 libitm/config/arm/hwcap.cc
447 --- a/libitm/config/arm/hwcap.cc Sun Jul 26 15:46:23 2015 -0400
448 +++ b/libitm/config/arm/hwcap.cc Sun Jul 26 15:46:25 2015 -0400
449 @@ -40,7 +40,11 @@
451 #ifdef __linux__
452 #include <unistd.h>
453 +#ifdef __GLIBC__
454 #include <sys/fcntl.h>
455 +#else
456 +#include <fcntl.h>
457 +#endif
458 #include <elf.h>
460 static void __attribute__((constructor))
461 # HG changeset patch
462 # Parent 23dcf3fd5965c339fd12202b74d049580db9375f
463 Support for mips-linux-musl.
465 diff -r 23dcf3fd5965 gcc/config/mips/linux.h
466 --- a/gcc/config/mips/linux.h Thu Dec 24 10:52:59 2015 -0500
467 +++ b/gcc/config/mips/linux.h Thu Dec 24 10:54:31 2015 -0500
468 @@ -31,6 +31,13 @@
469 #undef UCLIBC_DYNAMIC_LINKER32
470 #define UCLIBC_DYNAMIC_LINKER32 \
471 "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
473 +#undef MUSL_DYNAMIC_LINKER32
474 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips%{EL:el}%{msoft-float:-sf}.so.1"
475 +#undef MUSL_DYNAMIC_LINKER64
476 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips64%{EL:el}%{msoft-float:-sf}.so.1"
477 +#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mipsn32%{EL:el}%{msoft-float:-sf}.so.1"
479 #undef UCLIBC_DYNAMIC_LINKER64
480 #define UCLIBC_DYNAMIC_LINKER64 \
481 "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
482 @@ -40,4 +47,4 @@
483 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
484 #define GNU_USER_DYNAMIC_LINKERN32 \
485 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
486 - BIONIC_DYNAMIC_LINKERN32)
487 + BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
488 # HG changeset patch
489 # Parent 6becd1fa75bd2bef8af8ca711b089083d6d1192f
490 Support for powerpc-linux-musl.
492 diff -r 6becd1fa75bd gcc/config.gcc
493 --- a/gcc/config.gcc Sun Jul 26 15:46:27 2015 -0400
494 +++ b/gcc/config.gcc Sun Jul 26 15:46:29 2015 -0400
495 @@ -2410,6 +2410,10 @@
496 powerpc*-*-linux*paired*)
497 tm_file="${tm_file} rs6000/750cl.h" ;;
498 esac
499 + case ${target} in
500 + *-linux*-musl*)
501 + enable_secureplt=yes ;;
502 + esac
503 if test x${enable_secureplt} = xyes; then
504 tm_file="rs6000/secureplt.h ${tm_file}"
506 diff -r 6becd1fa75bd gcc/config/rs6000/linux64.h
507 --- a/gcc/config/rs6000/linux64.h Sun Jul 26 15:46:27 2015 -0400
508 +++ b/gcc/config/rs6000/linux64.h Sun Jul 26 15:46:29 2015 -0400
509 @@ -365,17 +365,21 @@
510 #endif
511 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
512 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
513 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
514 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
515 #if DEFAULT_LIBC == LIBC_UCLIBC
516 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
517 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
518 #elif DEFAULT_LIBC == LIBC_GLIBC
519 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
520 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
521 +#elif DEFAULT_LIBC == LIBC_MUSL
522 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
523 #else
524 #error "Unsupported DEFAULT_LIBC"
525 #endif
526 #define GNU_USER_DYNAMIC_LINKER32 \
527 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
528 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
529 #define GNU_USER_DYNAMIC_LINKER64 \
530 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
531 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
533 #undef DEFAULT_ASM_ENDIAN
534 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
535 diff -r 6becd1fa75bd gcc/config/rs6000/secureplt.h
536 --- a/gcc/config/rs6000/secureplt.h Sun Jul 26 15:46:27 2015 -0400
537 +++ b/gcc/config/rs6000/secureplt.h Sun Jul 26 15:46:29 2015 -0400
538 @@ -18,3 +18,4 @@
539 <http://www.gnu.org/licenses/>. */
541 #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
542 +#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
543 diff -r 6becd1fa75bd gcc/config/rs6000/sysv4.h
544 --- a/gcc/config/rs6000/sysv4.h Sun Jul 26 15:46:27 2015 -0400
545 +++ b/gcc/config/rs6000/sysv4.h Sun Jul 26 15:46:29 2015 -0400
546 @@ -537,6 +537,9 @@
547 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
548 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
549 #endif
550 +#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
551 +#define LINK_SECURE_PLT_DEFAULT_SPEC ""
552 +#endif
554 /* Pass -G xxx to the compiler. */
555 #undef CC1_SPEC
556 @@ -586,7 +589,8 @@
558 /* Override the default target of the linker. */
559 #define LINK_TARGET_SPEC \
560 - ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
561 + ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
562 + "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
564 /* Any specific OS flags. */
565 #define LINK_OS_SPEC "\
566 @@ -764,15 +768,18 @@
568 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
569 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
570 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
571 #if DEFAULT_LIBC == LIBC_UCLIBC
572 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
573 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
574 +#elif DEFAULT_LIBC == LIBC_MUSL
575 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
576 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
577 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
578 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
579 #else
580 #error "Unsupported DEFAULT_LIBC"
581 #endif
582 #define GNU_USER_DYNAMIC_LINKER \
583 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
584 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
586 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
587 %{rdynamic:-export-dynamic} \
588 @@ -895,6 +902,7 @@
589 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
590 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
591 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
592 + { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
593 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
594 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
595 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
596 diff -r cfc01b6ff516 gcc/config/aarch64/aarch64-linux.h
597 --- a/gcc/config/aarch64/aarch64-linux.h Sun Jul 26 15:46:29 2015 -0400
598 +++ b/gcc/config/aarch64/aarch64-linux.h Sun Jul 26 15:46:32 2015 -0400
599 @@ -29,6 +29,8 @@
600 #undef CC1_SPEC
601 #define CC1_SPEC GNU_USER_TARGET_CC1_SPEC ASAN_CC1_SPEC
603 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64.so.1"
605 #define CPP_SPEC "%{pthread:-D_REENTRANT}"
607 #define LINUX_TARGET_LINK_SPEC "%{h*} \
608 # HG changeset patch
609 # Parent 25bb57ef02c8b09bbc585f0ea719b7f128a1ef18
610 Microblaze support (again).
612 diff -r 25bb57ef02c8 gcc/config/microblaze/linux.h
613 --- a/gcc/config/microblaze/linux.h Sun Jul 26 15:46:32 2015 -0400
614 +++ b/gcc/config/microblaze/linux.h Sun Jul 26 15:46:34 2015 -0400
615 @@ -28,7 +28,22 @@
616 #undef TLS_NEEDS_GOT
617 #define TLS_NEEDS_GOT 1
619 -#define DYNAMIC_LINKER "/lib/ld.so.1"
620 +#if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */
621 +#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
622 +#else
623 +#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
624 +#endif
626 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
627 +#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
629 +#if DEFAULT_LIBC == LIBC_MUSL
630 +#define DYNAMIC_LINKER MUSL_DYNAMIC_LINKER
631 +#else
632 +#define DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
633 +#endif
636 #undef SUBTARGET_EXTRA_SPECS
637 #define SUBTARGET_EXTRA_SPECS \
638 { "dynamic_linker", DYNAMIC_LINKER }
639 From 478ee0c03a08e2ef9371fd88d516738936943e78 Mon Sep 17 00:00:00 2001
640 From: David Holsgrove <david.holsgrove@xilinx.com>
641 Date: Fri, 28 Sep 2012 16:32:03 +1000
642 Subject: [PATCH 06/11] [Patch, microblaze]: Add SIZE_TYPE and PTRDIFF_TYPE to
643 microblaze.h
645 Fixes warnings like;
647 warning: format '%zX' expects argument of type 'size_t',
648 but argument 3 has type 'unsigned int' [-Wformat]
650 Changelog
652 2013-03-18 David Holsgrove <david.holsgrove@xilinx.com>
654 * gcc/config/microblaze/microblaze.h: Define SIZE_TYPE
655 and PTRDIFF_TYPE.
657 Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
659 gcc/config/microblaze/microblaze.h | 6 ++++++
660 1 file changed, 6 insertions(+)
662 diff -r d2ca267e7e1a gcc/config/microblaze/microblaze.h
663 --- a/gcc/config/microblaze/microblaze.h Sun Jul 26 15:46:34 2015 -0400
664 +++ b/gcc/config/microblaze/microblaze.h Sun Jul 26 15:46:36 2015 -0400
665 @@ -218,6 +218,12 @@
666 #undef PTRDIFF_TYPE
667 #define PTRDIFF_TYPE "int"
669 +#undef SIZE_TYPE
670 +#define SIZE_TYPE "unsigned int"
672 +#undef PTRDIFF_TYPE
673 +#define PTRDIFF_TYPE "int"
675 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
676 ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \
677 && (ALIGN) < BITS_PER_WORD \
678 diff -r 2318e0db0d53 gcc/config/sh/linux.h
679 --- a/gcc/config/sh/linux.h Fri Sep 28 16:32:03 2012 +1000
680 +++ b/gcc/config/sh/linux.h Sun Jul 26 15:46:38 2015 -0400
681 @@ -43,7 +43,14 @@
683 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
685 +#if TARGET_BIG_ENDIAN_DEFAULT /* BE */
686 +#define MUSL_DYNAMIC_LINKER_E "eb"
687 +#else
688 +#define MUSL_DYNAMIC_LINKER_E
689 +#endif
691 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
692 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E ".so.1"
694 #undef SUBTARGET_LINK_EMUL_SUFFIX
695 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
696 Do not use weak references on any targets for gthread. Necessary on musl, safe elsewhere.
698 diff -r d2b373a6ad39 libgcc/gthr.h
699 --- a/libgcc/gthr.h Thu Jan 29 18:59:33 2015 -0500
700 +++ b/libgcc/gthr.h Thu Jan 29 19:00:03 2015 -0500
701 @@ -136,10 +136,8 @@
702 /* The pe-coff weak support isn't fully compatible to ELF's weak.
703 For static libraries it might would work, but as we need to deal
704 with shared versions too, we disable it for mingw-targets. */
705 -#ifdef __MINGW32__
706 #undef GTHREAD_USE_WEAK
707 #define GTHREAD_USE_WEAK 0
708 -#endif
710 #ifndef GTHREAD_USE_WEAK
711 #define GTHREAD_USE_WEAK 1