2 # Parent 90a7a3809a7ccb60e357b5e88382260877f82257
3 Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
5 diff -r 90a7a3809a7c libstdc++-v3/configure.host
6 --- a/libstdc++-v3/configure.host Thu Dec 24 11:22:15 2015 -0500
7 +++ b/libstdc++-v3/configure.host Thu Dec 24 11:24:45 2015 -0500
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
15 + os_include_dir="os/generic"
19 if [ "$uclibc" = "yes" ]; then
20 os_include_dir="os/uclibc"
21 elif [ "$bionic" = "yes" ]; then
23 os_include_dir="os/gnu-linux"
30 os_include_dir="os/hpux"
33 # Parent 30a957f60ddb9ae9611c626b8303858c09efa53b
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 30a957f60ddb gcc/config.gcc
37 --- a/gcc/config.gcc Thu Dec 24 11:24:45 2015 -0500
38 +++ b/gcc/config.gcc Thu Dec 24 11:24:47 2015 -0500
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.
50 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
53 + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
56 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
58 diff -r 30a957f60ddb gcc/config/linux.h
59 --- a/gcc/config/linux.h Thu Dec 24 11:24:45 2015 -0500
60 +++ b/gcc/config/linux.h Thu Dec 24 11:24:47 2015 -0500
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)
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)
73 #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
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)
102 #error "Unsupported DEFAULT_LIBC"
103 #endif /* DEFAULT_LIBC */
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 },
143 +#define INCLUDE_DEFAULTS_MUSL_LOCAL
146 +#ifdef PREFIX_INCLUDE_DIR
147 +#define INCLUDE_DEFAULTS_MUSL_PREFIX \
148 + { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
150 +#define INCLUDE_DEFAULTS_MUSL_PREFIX
153 +#ifdef CROSS_INCLUDE_DIR
154 +#define INCLUDE_DEFAULTS_MUSL_CROSS \
155 + { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
157 +#define INCLUDE_DEFAULTS_MUSL_CROSS
160 +#ifdef TOOL_INCLUDE_DIR
161 +#define INCLUDE_DEFAULTS_MUSL_TOOL \
162 + { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
164 +#define INCLUDE_DEFAULTS_MUSL_TOOL
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 },
172 +#define INCLUDE_DEFAULTS_MUSL_NATIVE
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
181 +# undef INCLUDE_DEFAULTS_MUSL_CROSS
182 +# define INCLUDE_DEFAULTS_MUSL_CROSS
185 +#undef INCLUDE_DEFAULTS
186 +#define INCLUDE_DEFAULTS \
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 } \
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 30a957f60ddb gcc/config/linux.opt
202 --- a/gcc/config/linux.opt Thu Dec 24 11:24:45 2015 -0500
203 +++ b/gcc/config/linux.opt Thu Dec 24 11:24:47 2015 -0500
206 Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
210 +Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
212 diff -r 30a957f60ddb gcc/ginclude/stddef.h
213 --- a/gcc/ginclude/stddef.h Thu Dec 24 11:24:45 2015 -0500
214 +++ b/gcc/ginclude/stddef.h Thu Dec 24 11:24:47 2015 -0500
219 +#ifndef __DEFINED_size_t /* musl */
220 #define __size_t__ /* BeOS */
221 #define __SIZE_T__ /* Cray Unicos/Mk */
224 #define ___int_size_t_h
227 +#define __DEFINED_size_t /* musl */
228 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
229 || defined(__DragonFly__) \
230 || defined(__FreeBSD_kernel__)
232 typedef long ssize_t;
233 #endif /* __BEOS__ */
234 #endif /* !(defined (__GNUG__) && defined (size_t)) */
235 +#endif /* __DEFINED_size_t */
236 #endif /* __size_t */
238 #endif /* _GCC_SIZE_T */
240 # Parent 90228af47e55eb338c7f672e4aca5ac81cf5f14c
241 A fix for libgomp to correctly request a POSIX version for time support.
243 diff -r 90228af47e55 libgomp/config/posix/time.c
244 --- a/libgomp/config/posix/time.c Thu Dec 24 11:24:47 2015 -0500
245 +++ b/libgomp/config/posix/time.c Thu Dec 24 11:24:49 2015 -0500
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 */
254 #if TIME_WITH_SYS_TIME
255 diff -r b08d4bc3d2ba libgcc/unwind-dw2-fde-dip.c
256 --- a/libgcc/unwind-dw2-fde-dip.c Thu Dec 24 11:24:49 2015 -0500
257 +++ b/libgcc/unwind-dw2-fde-dip.c Thu Dec 24 11:24:51 2015 -0500
259 #include "unwind-compat.h"
262 +#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
263 +# define USE_PT_GNU_EH_FRAME
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 9ce80db9f342 gcc/configure
270 --- a/gcc/configure Thu Dec 24 11:24:51 2015 -0500
271 +++ b/gcc/configure Thu Dec 24 11:24:53 2015 -0500
272 @@ -27802,6 +27802,9 @@
274 gcc_cv_libc_provides_ssp=no
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 @@ -27834,6 +27837,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 @@ -27930,6 +27934,9 @@
291 gcc_cv_target_dl_iterate_phdr=no
295 + gcc_cv_target_dl_iterate_phdr=yes
299 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
300 diff -r 9ce80db9f342 gcc/configure.ac
301 --- a/gcc/configure.ac Thu Dec 24 11:24:51 2015 -0500
302 +++ b/gcc/configure.ac Thu Dec 24 11:24:53 2015 -0500
303 @@ -5282,6 +5282,9 @@
304 gcc_cv_libc_provides_ssp,
305 [gcc_cv_libc_provides_ssp=no
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 @@ -5308,6 +5311,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 @@ -5381,6 +5385,9 @@
322 gcc_cv_target_dl_iterate_phdr=no
326 + gcc_cv_target_dl_iterate_phdr=yes
329 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
330 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
331 diff -r 1f375ed3689f gcc/gcc.c
332 --- a/gcc/gcc.c Thu Dec 24 11:24:53 2015 -0500
333 +++ b/gcc/gcc.c Thu Dec 24 11:24:56 2015 -0500
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}"
341 #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
342 "|fstack-protector-strong|fstack-protector-explicit" \
344 # Parent 2efa181e019464316d8babc0edbf301e51daea1f
345 Get rid of ever-broken fixincludes on musl.
347 diff -r 2efa181e0194 fixincludes/mkfixinc.sh
348 --- a/fixincludes/mkfixinc.sh Thu Dec 24 11:24:56 2015 -0500
349 +++ b/fixincludes/mkfixinc.sh Thu Dec 24 11:24:58 2015 -0500
353 powerpcle-*-eabisim* | \
354 - powerpcle-*-eabi* )
355 + powerpcle-*-eabi* | \
357 # IF there is no include fixing,
358 # THEN create a no-op fixer and exit
359 (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
361 # Parent 3736940c2173c88ace7fd0ecd39ca7be7fb3cbdf
362 Support for i386-linux-musl and x86_64-linux-musl.
364 diff -r 3736940c2173 gcc/config/i386/linux.h
365 --- a/gcc/config/i386/linux.h Thu Dec 24 11:24:58 2015 -0500
366 +++ b/gcc/config/i386/linux.h Thu Dec 24 11:25:00 2015 -0500
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 3736940c2173 gcc/config/i386/linux64.h
373 --- a/gcc/config/i386/linux64.h Thu Dec 24 11:24:58 2015 -0500
374 +++ b/gcc/config/i386/linux64.h Thu Dec 24 11:25:00 2015 -0500
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 3736940c2173 libitm/config/linux/x86/tls.h
384 --- a/libitm/config/linux/x86/tls.h Thu Dec 24 11:24:58 2015 -0500
385 +++ b/libitm/config/linux/x86/tls.h Thu Dec 24 11:25:00 2015 -0500
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
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 {
411 #endif /* >= GLIBC 2.10 */
414 #endif // LIBITM_X86_TLS_H
416 # Parent 2aec960ba139618582698a9c80bacc5da6bbaf4d
417 Support for arm-linux-musl.
419 diff -r 2aec960ba139 gcc/config/arm/linux-eabi.h
420 --- a/gcc/config/arm/linux-eabi.h Thu Dec 24 11:25:00 2015 -0500
421 +++ b/gcc/config/arm/linux-eabi.h Thu Dec 24 11:25:02 2015 -0500
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}"
438 +#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
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. */
446 diff -r 2aec960ba139 libitm/config/arm/hwcap.cc
447 --- a/libitm/config/arm/hwcap.cc Thu Dec 24 11:25:00 2015 -0500
448 +++ b/libitm/config/arm/hwcap.cc Thu Dec 24 11:25:02 2015 -0500
454 #include <sys/fcntl.h>
460 static void __attribute__((constructor))
462 # Parent 76b553fabcf19eec5df2df7f05ce15a4bf8c3996
463 Support for mips-linux-musl.
465 diff -r 76b553fabcf1 gcc/config/mips/linux.h
466 --- a/gcc/config/mips/linux.h Thu Dec 24 11:25:02 2015 -0500
467 +++ b/gcc/config/mips/linux.h Thu Dec 24 11:25:04 2015 -0500
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}"
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)
489 # Parent 971d410411735f0b04eb07236659097986926213
490 Support for powerpc-linux-musl.
492 diff -r 971d41041173 gcc/config.gcc
493 --- a/gcc/config.gcc Fri Dec 25 08:44:09 2015 -0500
494 +++ b/gcc/config.gcc Fri Dec 25 09:42:16 2015 -0500
495 @@ -2416,6 +2416,10 @@
496 powerpc*-*-linux*paired*)
497 tm_file="${tm_file} rs6000/750cl.h" ;;
501 + enable_secureplt=yes ;;
503 if test x${enable_secureplt} = xyes; then
504 tm_file="rs6000/secureplt.h ${tm_file}"
506 diff -r 971d41041173 gcc/config/rs6000/linux64.h
507 --- a/gcc/config/rs6000/linux64.h Fri Dec 25 08:44:09 2015 -0500
508 +++ b/gcc/config/rs6000/linux64.h Fri Dec 25 09:42:16 2015 -0500
509 @@ -365,17 +365,21 @@
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 "}}"
524 #error "Unsupported DEFAULT_LIBC"
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 971d41041173 gcc/config/rs6000/secureplt.h
536 --- a/gcc/config/rs6000/secureplt.h Fri Dec 25 08:44:09 2015 -0500
537 +++ b/gcc/config/rs6000/secureplt.h Fri Dec 25 09:42:16 2015 -0500
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 971d41041173 gcc/config/rs6000/sysv4.h
544 --- a/gcc/config/rs6000/sysv4.h Fri Dec 25 08:44:09 2015 -0500
545 +++ b/gcc/config/rs6000/sysv4.h Fri Dec 25 09:42:16 2015 -0500
547 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
548 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
550 +#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
551 +#define LINK_SECURE_PLT_DEFAULT_SPEC ""
554 /* Pass -G xxx to the compiler. */
559 %{!T*: %(link_start) } \
562 +"%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
564 /* Shared libraries are not default. */
565 #define LINK_SHLIB_SPEC "\
566 @@ -759,15 +763,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 "}}"
580 #error "Unsupported DEFAULT_LIBC"
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} \
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 9555ffb5873b gcc/config/aarch64/aarch64-linux.h
597 --- a/gcc/config/aarch64/aarch64-linux.h Thu Dec 24 11:25:06 2015 -0500
598 +++ b/gcc/config/aarch64/aarch64-linux.h Thu Dec 24 11:25:09 2015 -0500
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*} \
609 # Parent 1058eabefb01a24459f8286e661cd6b421656201
610 Microblaze support (again).
612 diff -r 1058eabefb01 gcc/config/microblaze/linux.h
613 --- a/gcc/config/microblaze/linux.h Thu Dec 24 11:25:08 2015 -0500
614 +++ b/gcc/config/microblaze/linux.h Thu Dec 24 11:25:11 2015 -0500
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}"
623 +#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
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
632 +#define DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
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
647 warning: format '%zX' expects argument of type 'size_t',
648 but argument 3 has type 'unsigned int' [-Wformat]
652 2013-03-18 David Holsgrove <david.holsgrove@xilinx.com>
654 * gcc/config/microblaze/microblaze.h: Define SIZE_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 a522e4b04c77 gcc/config/microblaze/microblaze.h
663 --- a/gcc/config/microblaze/microblaze.h Thu Dec 24 11:25:11 2015 -0500
664 +++ b/gcc/config/microblaze/microblaze.h Thu Dec 24 11:25:13 2015 -0500
667 #define PTRDIFF_TYPE "int"
670 +#define SIZE_TYPE "unsigned int"
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 f2936ad874dd 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 Thu Dec 24 11:25:15 2015 -0500
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"
688 +#define MUSL_DYNAMIC_LINKER_E
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 e180e4cfc879 libgcc/gthr.h
699 --- a/libgcc/gthr.h Thu Dec 24 11:25:15 2015 -0500
700 +++ b/libgcc/gthr.h Thu Dec 24 11:25:17 2015 -0500
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. */
706 #undef GTHREAD_USE_WEAK
707 #define GTHREAD_USE_WEAK 0
710 #ifndef GTHREAD_USE_WEAK
711 #define GTHREAD_USE_WEAK 1