bump musl default version to 1.1.20
[rofl0r-mmix-cross.git] / patches / gcc-4.8.5-musl.diff
blob62d35367970194529af83e869923335519b918b4
1 # HG changeset patch
2 # Parent a486e19894520b80db43d63b0538e53c7dd87554
3 Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
5 diff -r a486e1989452 libstdc++-v3/configure.host
6 --- a/libstdc++-v3/configure.host Fri Dec 25 15:12:57 2015 -0500
7 +++ b/libstdc++-v3/configure.host Fri Dec 25 15:16:08 2015 -0500
8 @@ -263,6 +263,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 @@ -271,6 +278,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 bf2a3ca778408e1d93b9d51d2dde7f7f4e195dbd
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 bf2a3ca77840 gcc/config.gcc
37 --- a/gcc/config.gcc Fri Dec 25 15:16:08 2015 -0500
38 +++ b/gcc/config.gcc Fri Dec 25 15:16:12 2015 -0500
39 @@ -550,7 +550,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 @@ -653,6 +653,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 bf2a3ca77840 gcc/config/linux.h
59 --- a/gcc/config/linux.h Fri Dec 25 15:16:08 2015 -0500
60 +++ b/gcc/config/linux.h Fri Dec 25 15:16:12 2015 -0500
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 bf2a3ca77840 gcc/config/linux.opt
207 --- a/gcc/config/linux.opt Fri Dec 25 15:16:08 2015 -0500
208 +++ b/gcc/config/linux.opt Fri Dec 25 15:16:12 2015 -0500
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 bf2a3ca77840 gcc/ginclude/stddef.h
218 --- a/gcc/ginclude/stddef.h Fri Dec 25 15:16:08 2015 -0500
219 +++ b/gcc/ginclude/stddef.h Fri Dec 25 15:16:12 2015 -0500
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 1809f3990fa4d35d0dd694cc17d118dfcfd4e543
246 A fix for libgomp to correctly request a POSIX version for time support.
248 diff -r 1809f3990fa4 libgomp/config/posix/time.c
249 --- a/libgomp/config/posix/time.c Fri Dec 25 15:16:12 2015 -0500
250 +++ b/libgomp/config/posix/time.c Fri Dec 25 15:16:15 2015 -0500
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 c258e8904d94 libgcc/unwind-dw2-fde-dip.c
261 --- a/libgcc/unwind-dw2-fde-dip.c Fri Dec 25 15:16:15 2015 -0500
262 +++ b/libgcc/unwind-dw2-fde-dip.c Fri Dec 25 15:16:18 2015 -0500
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_##type
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 cd50df2475e3 gcc/configure
304 --- a/gcc/configure Fri Dec 25 15:16:18 2015 -0500
305 +++ b/gcc/configure Fri Dec 25 15:16:22 2015 -0500
306 @@ -26852,6 +26852,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 @@ -26885,6 +26888,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 @@ -26967,6 +26971,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 cd50df2475e3 gcc/configure.ac
335 --- a/gcc/configure.ac Fri Dec 25 15:16:18 2015 -0500
336 +++ b/gcc/configure.ac Fri Dec 25 15:16:22 2015 -0500
337 @@ -4776,6 +4776,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 @@ -4809,6 +4812,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 @@ -4874,6 +4878,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 18e0b8706ee6caafebec9fb79bd66005c1e32d6e
367 Get rid of ever-broken fixincludes on musl.
369 diff -r 18e0b8706ee6 fixincludes/mkfixinc.sh
370 --- a/fixincludes/mkfixinc.sh Fri Dec 25 15:16:22 2015 -0500
371 +++ b/fixincludes/mkfixinc.sh Fri Dec 25 15:16:25 2015 -0500
372 @@ -19,7 +19,8 @@
373 powerpc-*-eabi* | \
374 powerpc-*-rtems* | \
375 powerpcle-*-eabisim* | \
376 - powerpcle-*-eabi* )
377 + powerpcle-*-eabi* | \
378 + *-musl* )
379 # IF there is no include fixing,
380 # THEN create a no-op fixer and exit
381 (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
382 # HG changeset patch
383 # Parent 5debdd6659c1374a8e49bc84960aef53ab9b07da
384 Support for i386-linux-musl and x86_64-linux-musl.
386 diff -r 5debdd6659c1 gcc/config/i386/linux.h
387 --- a/gcc/config/i386/linux.h Fri Dec 25 15:16:25 2015 -0500
388 +++ b/gcc/config/i386/linux.h Fri Dec 25 15:16:28 2015 -0500
389 @@ -21,3 +21,4 @@
391 #define GNU_USER_LINK_EMULATION "elf_i386"
392 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
393 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
394 diff -r 5debdd6659c1 gcc/config/i386/linux64.h
395 --- a/gcc/config/i386/linux64.h Fri Dec 25 15:16:25 2015 -0500
396 +++ b/gcc/config/i386/linux64.h Fri Dec 25 15:16:28 2015 -0500
397 @@ -30,3 +30,7 @@
398 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
399 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
400 #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
402 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
403 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
404 +#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
405 diff -r 5debdd6659c1 libitm/config/linux/x86/tls.h
406 --- a/libitm/config/linux/x86/tls.h Fri Dec 25 15:16:25 2015 -0500
407 +++ b/libitm/config/linux/x86/tls.h Fri Dec 25 15:16:28 2015 -0500
408 @@ -25,16 +25,19 @@
409 #ifndef LIBITM_X86_TLS_H
410 #define LIBITM_X86_TLS_H 1
412 -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
413 +#if defined(__GLIBC_PREREQ)
414 +#if __GLIBC_PREREQ(2, 10)
415 /* Use slots in the TCB head rather than __thread lookups.
416 GLIBC has reserved words 10 through 13 for TM. */
417 #define HAVE_ARCH_GTM_THREAD 1
418 #define HAVE_ARCH_GTM_THREAD_DISP 1
419 #endif
420 +#endif
422 #include "config/generic/tls.h"
424 -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
425 +#if defined(__GLIBC_PREREQ)
426 +#if __GLIBC_PREREQ(2, 10)
427 namespace GTM HIDDEN {
429 #ifdef __x86_64__
430 @@ -101,5 +104,6 @@
432 } // namespace GTM
433 #endif /* >= GLIBC 2.10 */
434 +#endif
436 #endif // LIBITM_X86_TLS_H
437 # HG changeset patch
438 # Parent 61fde47d5a9289fa4e92d236113d8143f4f5dad9
439 Support for arm-linux-musl.
441 diff -r 61fde47d5a92 gcc/config/arm/linux-eabi.h
442 --- a/gcc/config/arm/linux-eabi.h Fri Dec 25 15:16:28 2015 -0500
443 +++ b/gcc/config/arm/linux-eabi.h Fri Dec 25 15:16:32 2015 -0500
444 @@ -77,6 +77,23 @@
445 %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
446 %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
448 +/* For ARM musl currently supports four dynamic linkers:
449 + - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
450 + - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
451 + - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
452 + - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
453 + musl does not support the legacy OABI mode.
454 + All the dynamic linkers live in /lib.
455 + We default to soft-float, EL. */
456 +#undef MUSL_DYNAMIC_LINKER
457 +#if TARGET_BIG_ENDIAN_DEFAULT
458 +#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
459 +#else
460 +#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
461 +#endif
462 +#define MUSL_DYNAMIC_LINKER \
463 + "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
465 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
466 use the GNU/Linux version, not the generic BPABI version. */
467 #undef LINK_SPEC
468 diff -r 61fde47d5a92 libitm/config/arm/hwcap.cc
469 --- a/libitm/config/arm/hwcap.cc Fri Dec 25 15:16:28 2015 -0500
470 +++ b/libitm/config/arm/hwcap.cc Fri Dec 25 15:16:32 2015 -0500
471 @@ -40,7 +40,11 @@
473 #ifdef __linux__
474 #include <unistd.h>
475 +#ifdef __GLIBC__
476 #include <sys/fcntl.h>
477 +#else
478 +#include <fcntl.h>
479 +#endif
480 #include <elf.h>
482 static void __attribute__((constructor))
483 # HG changeset patch
484 # Parent 07e20048931c7f84160dfdab3a6a8a1b08d3207e
485 Support for mips-linux-musl.
487 diff -r 07e20048931c gcc/config/mips/linux.h
488 --- a/gcc/config/mips/linux.h Fri Dec 25 15:16:32 2015 -0500
489 +++ b/gcc/config/mips/linux.h Fri Dec 25 15:16:35 2015 -0500
490 @@ -18,3 +18,10 @@
491 <http://www.gnu.org/licenses/>. */
493 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
495 +#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
496 +#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
497 +#else
498 +#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
499 +#endif
500 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1"
501 # HG changeset patch
502 # Parent c68dba2c24146bc3fc8dabf6a05e1663b7b4159a
503 Support for powerpc-linux-musl.
505 diff -r c68dba2c2414 gcc/config.gcc
506 --- a/gcc/config.gcc Fri Dec 25 15:16:35 2015 -0500
507 +++ b/gcc/config.gcc Fri Dec 25 15:16:38 2015 -0500
508 @@ -2148,6 +2148,10 @@
509 powerpc*-*-linux*paired*)
510 tm_file="${tm_file} rs6000/750cl.h" ;;
511 esac
512 + case ${target} in
513 + *-linux*-musl*)
514 + enable_secureplt=yes ;;
515 + esac
516 if test x${enable_secureplt} = xyes; then
517 tm_file="rs6000/secureplt.h ${tm_file}"
519 diff -r c68dba2c2414 gcc/config/rs6000/linux64.h
520 --- a/gcc/config/rs6000/linux64.h Fri Dec 25 15:16:35 2015 -0500
521 +++ b/gcc/config/rs6000/linux64.h Fri Dec 25 15:16:38 2015 -0500
522 @@ -370,17 +370,21 @@
523 #endif
524 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
525 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
526 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
527 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
528 #if DEFAULT_LIBC == LIBC_UCLIBC
529 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
530 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
531 #elif DEFAULT_LIBC == LIBC_GLIBC
532 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
533 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
534 +#elif DEFAULT_LIBC == LIBC_MUSL
535 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
536 #else
537 #error "Unsupported DEFAULT_LIBC"
538 #endif
539 #define GNU_USER_DYNAMIC_LINKER32 \
540 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
541 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
542 #define GNU_USER_DYNAMIC_LINKER64 \
543 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
544 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
546 #undef DEFAULT_ASM_ENDIAN
547 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
548 diff -r c68dba2c2414 gcc/config/rs6000/secureplt.h
549 --- a/gcc/config/rs6000/secureplt.h Fri Dec 25 15:16:35 2015 -0500
550 +++ b/gcc/config/rs6000/secureplt.h Fri Dec 25 15:16:38 2015 -0500
551 @@ -18,3 +18,4 @@
552 <http://www.gnu.org/licenses/>. */
554 #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
555 +#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
556 diff -r c68dba2c2414 gcc/config/rs6000/sysv4.h
557 --- a/gcc/config/rs6000/sysv4.h Fri Dec 25 15:16:35 2015 -0500
558 +++ b/gcc/config/rs6000/sysv4.h Fri Dec 25 15:16:38 2015 -0500
559 @@ -537,6 +537,9 @@
560 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
561 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
562 #endif
563 +#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
564 +#define LINK_SECURE_PLT_DEFAULT_SPEC ""
565 +#endif
567 /* Pass -G xxx to the compiler. */
568 #define CC1_SPEC "%{G*} %(cc1_cpu)" \
569 @@ -585,7 +588,8 @@
571 /* Override the default target of the linker. */
572 #define LINK_TARGET_SPEC \
573 - ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
574 + ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
575 + "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
577 /* Any specific OS flags. */
578 #define LINK_OS_SPEC "\
579 @@ -763,15 +767,18 @@
581 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
582 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
583 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
584 #if DEFAULT_LIBC == LIBC_UCLIBC
585 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
586 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
587 +#elif DEFAULT_LIBC == LIBC_MUSL
588 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
589 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
590 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
591 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
592 #else
593 #error "Unsupported DEFAULT_LIBC"
594 #endif
595 #define GNU_USER_DYNAMIC_LINKER \
596 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
597 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
599 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
600 %{rdynamic:-export-dynamic} \
601 @@ -894,6 +901,7 @@
602 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
603 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
604 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
605 + { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
606 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
607 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
608 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
609 diff -r b949cf6ae064 gcc/config/aarch64/aarch64-linux.h
610 --- a/gcc/config/aarch64/aarch64-linux.h Fri Dec 25 15:16:38 2015 -0500
611 +++ b/gcc/config/aarch64/aarch64-linux.h Fri Dec 25 15:16:42 2015 -0500
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 CPP_SPEC "%{pthread:-D_REENTRANT}"
624 # HG changeset patch
625 # Parent c0ba776169de0165fd173f289e4e3855ea4d8b56
626 Microblaze support (again).
628 diff -r c0ba776169de gcc/config/microblaze/linux.h
629 --- a/gcc/config/microblaze/linux.h Fri Dec 25 15:16:42 2015 -0500
630 +++ b/gcc/config/microblaze/linux.h Fri Dec 25 15:16:45 2015 -0500
631 @@ -28,7 +28,22 @@
632 #undef TLS_NEEDS_GOT
633 #define TLS_NEEDS_GOT 1
635 -#define DYNAMIC_LINKER "/lib/ld.so.1"
636 +#if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */
637 +#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
638 +#else
639 +#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
640 +#endif
642 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
643 +#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
645 +#if DEFAULT_LIBC == LIBC_MUSL
646 +#define DYNAMIC_LINKER MUSL_DYNAMIC_LINKER
647 +#else
648 +#define DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
649 +#endif
652 #undef SUBTARGET_EXTRA_SPECS
653 #define SUBTARGET_EXTRA_SPECS \
654 { "dynamic_linker", DYNAMIC_LINKER }
655 From 478ee0c03a08e2ef9371fd88d516738936943e78 Mon Sep 17 00:00:00 2001
656 From: David Holsgrove <david.holsgrove@xilinx.com>
657 Date: Fri, 28 Sep 2012 16:32:03 +1000
658 Subject: [PATCH 06/11] [Patch, microblaze]: Add SIZE_TYPE and PTRDIFF_TYPE to
659 microblaze.h
661 Fixes warnings like;
663 warning: format '%zX' expects argument of type 'size_t',
664 but argument 3 has type 'unsigned int' [-Wformat]
666 Changelog
668 2013-03-18 David Holsgrove <david.holsgrove@xilinx.com>
670 * gcc/config/microblaze/microblaze.h: Define SIZE_TYPE
671 and PTRDIFF_TYPE.
673 Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
675 gcc/config/microblaze/microblaze.h | 6 ++++++
676 1 file changed, 6 insertions(+)
678 diff -r accbbad13ee4 gcc/config/microblaze/microblaze.h
679 --- a/gcc/config/microblaze/microblaze.h Fri Dec 25 15:16:45 2015 -0500
680 +++ b/gcc/config/microblaze/microblaze.h Fri Dec 25 15:16:49 2015 -0500
681 @@ -219,6 +219,12 @@
682 #undef PTRDIFF_TYPE
683 #define PTRDIFF_TYPE "int"
685 +#undef SIZE_TYPE
686 +#define SIZE_TYPE "unsigned int"
688 +#undef PTRDIFF_TYPE
689 +#define PTRDIFF_TYPE "int"
691 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
692 ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \
693 && (ALIGN) < BITS_PER_WORD \
694 diff -r 5fcbcd84671f gcc/config/sh/linux.h
695 --- a/gcc/config/sh/linux.h Fri Sep 28 16:32:03 2012 +1000
696 +++ b/gcc/config/sh/linux.h Fri Dec 25 15:16:52 2015 -0500
697 @@ -43,7 +43,14 @@
699 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
701 +#if TARGET_BIG_ENDIAN_DEFAULT /* BE */
702 +#define MUSL_DYNAMIC_LINKER_E "eb"
703 +#else
704 +#define MUSL_DYNAMIC_LINKER_E
705 +#endif
707 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
708 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E ".so.1"
710 #undef SUBTARGET_LINK_EMUL_SUFFIX
711 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
712 Fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
713 wrong warning when using the universal zero initializer {0}
715 Backported to GCC 4.8.3
717 Subject: 2014-06-05 S. Gilles <sgilles@terpmail.umd.edu>
718 X-Git-Url: http://repo.or.cz/w/official-gcc.git/commitdiff_plain/95cdf3fdf2d440eb7775def8e35ab970651c33d9?hp=14a3093e9943937cbc63dfbf4d51ca60f8325b29
719 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211289 138bc75d-0d04-0410-961f-82ee72b054a4
721 diff -r d5d2910a3b6e gcc/c/c-typeck.c
722 --- a/gcc/c/c-typeck.c Fri Dec 25 15:16:52 2015 -0500
723 +++ b/gcc/c/c-typeck.c Fri Dec 25 15:16:56 2015 -0500
724 @@ -62,9 +62,9 @@
725 if expr.original_code == SIZEOF_EXPR. */
726 tree c_last_sizeof_arg;
728 -/* Nonzero if we've already printed a "missing braces around initializer"
729 - message within this initializer. */
730 -static int missing_braces_mentioned;
731 +/* Nonzero if we might need to print a "missing braces around
732 + initializer" message within this initializer. */
733 +static int found_missing_braces;
735 static int require_constant_value;
736 static int require_constant_elements;
737 @@ -6380,6 +6380,9 @@
738 /* 1 if this constructor is erroneous so far. */
739 static int constructor_erroneous;
741 +/* 1 if this constructor is the universal zero initializer { 0 }. */
742 +static int constructor_zeroinit;
744 /* Structure for managing pending initializer elements, organized as an
745 AVL tree. */
747 @@ -6541,7 +6544,7 @@
748 constructor_stack = 0;
749 constructor_range_stack = 0;
751 - missing_braces_mentioned = 0;
752 + found_missing_braces = 0;
754 spelling_base = 0;
755 spelling_size = 0;
756 @@ -6636,6 +6639,7 @@
757 constructor_type = type;
758 constructor_incremental = 1;
759 constructor_designated = 0;
760 + constructor_zeroinit = 1;
761 designator_depth = 0;
762 designator_erroneous = 0;
764 @@ -6833,11 +6837,8 @@
765 set_nonincremental_init (braced_init_obstack);
768 - if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned)
770 - missing_braces_mentioned = 1;
771 - warning_init (OPT_Wmissing_braces, "missing braces around initializer");
773 + if (implicit == 1)
774 + found_missing_braces = 1;
776 if (TREE_CODE (constructor_type) == RECORD_TYPE
777 || TREE_CODE (constructor_type) == UNION_TYPE)
778 @@ -6970,16 +6971,23 @@
782 + if (vec_safe_length (constructor_elements) != 1)
783 + constructor_zeroinit = 0;
785 + /* Warn when some structs are initialized with direct aggregation. */
786 + if (!implicit && found_missing_braces && warn_missing_braces
787 + && !constructor_zeroinit)
789 + warning_init (OPT_Wmissing_braces,
790 + "missing braces around initializer");
793 /* Warn when some struct elements are implicitly initialized to zero. */
794 if (warn_missing_field_initializers
795 && constructor_type
796 && TREE_CODE (constructor_type) == RECORD_TYPE
797 && constructor_unfilled_fields)
799 - bool constructor_zeroinit =
800 - (vec_safe_length (constructor_elements) == 1
801 - && integer_zerop ((*constructor_elements)[0].value));
803 /* Do not warn for flexible array members or zero-length arrays. */
804 while (constructor_unfilled_fields
805 && (!DECL_SIZE (constructor_unfilled_fields)
806 @@ -8094,6 +8102,9 @@
807 designator_depth = 0;
808 designator_erroneous = 0;
810 + if (!implicit && value.value && !integer_zerop (value.value))
811 + constructor_zeroinit = 0;
813 /* Handle superfluous braces around string cst as in
814 char x[] = {"foo"}; */
815 if (string_flag
816 diff -r a5e074ee9347 gcc/gcc.c
817 --- a/gcc/gcc.c Fri Dec 25 15:16:56 2015 -0500
818 +++ b/gcc/gcc.c Fri Dec 25 15:16:59 2015 -0500
819 @@ -653,7 +653,7 @@
821 #ifndef LINK_SSP_SPEC
822 #ifdef TARGET_LIBC_PROVIDES_SSP
823 -#define LINK_SSP_SPEC "%{fstack-protector:}"
824 +#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared}"
825 #else
826 #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared -lssp}"
827 #endif