source: clfs-embedded/patches/gcc-4.7.3-musl-1.patch@ ebc4a9b

Last change on this file since ebc4a9b was c01e552, checked in by Andrew Bradford <andrew@…>, 11 years ago

Add musl patches for gcc and binutils

  • Property mode set to 100644
File size: 26.0 KB
RevLine 
[c01e552]1Submitted By: Andrew Bradford <andrew@bradfordembedded.com>
2Date: 2013-10-14
3Initial Package Version: 4.7.3
4Origin: Gregor Richards' musl-cross
5Upstream Status: None
6Description: Patches to gcc to build for musl-libc.
7
8# HG changeset patch
9# Parent f50bb54f331f73405131a30b4f353cfda1c70304
10Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
11
12diff -r f50bb54f331f libstdc++-v3/configure.host
13--- a/libstdc++-v3/configure.host Fri Mar 29 16:38:52 2013 -0400
14+++ b/libstdc++-v3/configure.host Fri Mar 29 16:41:10 2013 -0400
15@@ -264,6 +264,13 @@
16 os_include_dir="os/bsd/freebsd"
17 ;;
18 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
19+ # check for musl by target
20+ case "${host_os}" in
21+ *-musl*)
22+ os_include_dir="os/generic"
23+ ;;
24+ *)
25+
26 if [ "$uclibc" = "yes" ]; then
27 os_include_dir="os/uclibc"
28 elif [ "$bionic" = "yes" ]; then
29@@ -272,6 +279,9 @@
30 os_include_dir="os/gnu-linux"
31 fi
32 ;;
33+
34+ esac
35+ ;;
36 hpux*)
37 os_include_dir="os/hpux"
38 ;;
39# HG changeset patch
40# Parent 8cd76d5f6674f04c31523971d1dfc81c91388c38
41Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker.
42
43diff -r 8cd76d5f6674 gcc/config.gcc
44--- a/gcc/config.gcc Mon Sep 09 12:54:21 2013 -0400
45+++ b/gcc/config.gcc Mon Sep 09 12:54:37 2013 -0400
46@@ -522,7 +522,7 @@
47 esac
48
49 # Common C libraries.
50-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
51+tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
52
53 # Common parts for widely ported systems.
54 case ${target} in
55@@ -625,6 +625,9 @@
56 *-*-*uclibc*)
57 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
58 ;;
59+ *-*-*musl*)
60+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
61+ ;;
62 *)
63 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
64 ;;
65diff -r 8cd76d5f6674 gcc/config/linux.h
66--- a/gcc/config/linux.h Mon Sep 09 12:54:21 2013 -0400
67+++ b/gcc/config/linux.h Mon Sep 09 12:54:37 2013 -0400
68@@ -33,10 +33,12 @@
69 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
70 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
71 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
72+#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
73 #else
74 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
75 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
76 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
77+#define OPTION_MUSL (linux_libc == LIBC_MUSL)
78 #endif
79
80 #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
81@@ -54,18 +56,21 @@
82 uClibc or Bionic is the default C library and whether
83 -muclibc or -mglibc or -mbionic has been passed to change the default. */
84
85-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
86- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
87+#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
88+ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
89
90 #if DEFAULT_LIBC == LIBC_GLIBC
91-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
92- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
93+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
94+ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
95 #elif DEFAULT_LIBC == LIBC_UCLIBC
96-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
97- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
98+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
99+ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
100 #elif DEFAULT_LIBC == LIBC_BIONIC
101-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
102- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
103+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
104+ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
105+#elif DEFAULT_LIBC == LIBC_MUSL
106+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
107+ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
108 #else
109 #error "Unsupported DEFAULT_LIBC"
110 #endif /* DEFAULT_LIBC */
111@@ -85,21 +90,21 @@
112
113 #define GNU_USER_DYNAMIC_LINKER \
114 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
115- BIONIC_DYNAMIC_LINKER)
116+ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
117 #define GNU_USER_DYNAMIC_LINKER32 \
118 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
119- BIONIC_DYNAMIC_LINKER32)
120+ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
121 #define GNU_USER_DYNAMIC_LINKER64 \
122 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
123- BIONIC_DYNAMIC_LINKER64)
124+ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
125 #define GNU_USER_DYNAMIC_LINKERX32 \
126 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
127- BIONIC_DYNAMIC_LINKERX32)
128+ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
129
130 /* Determine whether the entire c99 runtime
131 is present in the runtime library. */
132 #undef TARGET_C99_FUNCTIONS
133-#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
134+#define TARGET_C99_FUNCTIONS (OPTION_GLIBC || OPTION_MUSL)
135
136 /* Whether we have sincos that follows the GNU extension. */
137 #undef TARGET_HAS_SINCOS
138@@ -108,3 +113,74 @@
139 /* Whether we have Bionic libc runtime */
140 #undef TARGET_HAS_BIONIC
141 #define TARGET_HAS_BIONIC (OPTION_BIONIC)
142+
143+/* musl avoids problematic includes by rearranging the include directories.
144+ * Unfortunately, this is mostly duplicated from cppdefault.c */
145+#if DEFAULT_LIBC == LIBC_MUSL
146+#define INCLUDE_DEFAULTS_MUSL_GPP \
147+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
148+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
149+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
150+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
151+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
152+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
153+
154+#ifdef LOCAL_INCLUDE_DIR
155+#define INCLUDE_DEFAULTS_MUSL_LOCAL \
156+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
157+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
158+#else
159+#define INCLUDE_DEFAULTS_MUSL_LOCAL
160+#endif
161+
162+#ifdef PREFIX_INCLUDE_DIR
163+#define INCLUDE_DEFAULTS_MUSL_PREFIX \
164+ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
165+#else
166+#define INCLUDE_DEFAULTS_MUSL_PREFIX
167+#endif
168+
169+#ifdef CROSS_INCLUDE_DIR
170+#define INCLUDE_DEFAULTS_MUSL_CROSS \
171+ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
172+#else
173+#define INCLUDE_DEFAULTS_MUSL_CROSS
174+#endif
175+
176+#ifdef TOOL_INCLUDE_DIR
177+#define INCLUDE_DEFAULTS_MUSL_TOOL \
178+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
179+#else
180+#define INCLUDE_DEFAULTS_MUSL_TOOL
181+#endif
182+
183+#ifdef NATIVE_SYSTEM_HEADER_DIR
184+#define INCLUDE_DEFAULTS_MUSL_NATIVE \
185+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
186+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
187+#else
188+#define INCLUDE_DEFAULTS_MUSL_NATIVE
189+#endif
190+
191+#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
192+# undef INCLUDE_DEFAULTS_MUSL_LOCAL
193+# define INCLUDE_DEFAULTS_MUSL_LOCAL
194+# undef INCLUDE_DEFAULTS_MUSL_NATIVE
195+# define INCLUDE_DEFAULTS_MUSL_NATIVE
196+#else
197+# undef INCLUDE_DEFAULTS_MUSL_CROSS
198+# define INCLUDE_DEFAULTS_MUSL_CROSS
199+#endif
200+
201+#undef INCLUDE_DEFAULTS
202+#define INCLUDE_DEFAULTS \
203+ { \
204+ INCLUDE_DEFAULTS_MUSL_GPP \
205+ INCLUDE_DEFAULTS_MUSL_PREFIX \
206+ INCLUDE_DEFAULTS_MUSL_CROSS \
207+ INCLUDE_DEFAULTS_MUSL_TOOL \
208+ INCLUDE_DEFAULTS_MUSL_NATIVE \
209+ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
210+ { 0, 0, 0, 0, 0, 0 } \
211+ }
212+#endif
213diff -r 8cd76d5f6674 gcc/config/linux.opt
214--- a/gcc/config/linux.opt Mon Sep 09 12:54:21 2013 -0400
215+++ b/gcc/config/linux.opt Mon Sep 09 12:54:37 2013 -0400
216@@ -30,3 +30,7 @@
217 muclibc
218 Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
219 Use uClibc C library
220+
221+mmusl
222+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
223+Use musl C library
224diff -r 8cd76d5f6674 gcc/ginclude/stddef.h
225--- a/gcc/ginclude/stddef.h Mon Sep 09 12:54:21 2013 -0400
226+++ b/gcc/ginclude/stddef.h Mon Sep 09 12:54:37 2013 -0400
227@@ -184,6 +184,7 @@
228 #ifndef _GCC_SIZE_T
229 #ifndef _SIZET_
230 #ifndef __size_t
231+#ifndef __DEFINED_size_t /* musl */
232 #define __size_t__ /* BeOS */
233 #define __SIZE_T__ /* Cray Unicos/Mk */
234 #define _SIZE_T
235@@ -200,6 +201,7 @@
236 #define ___int_size_t_h
237 #define _GCC_SIZE_T
238 #define _SIZET_
239+#define __DEFINED_size_t /* musl */
240 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
241 || defined(__FreeBSD_kernel__)
242 /* __size_t is a typedef on FreeBSD 5, must not trash it. */
243@@ -215,6 +217,7 @@
244 typedef long ssize_t;
245 #endif /* __BEOS__ */
246 #endif /* !(defined (__GNUG__) && defined (size_t)) */
247+#endif /* __DEFINED_size_t */
248 #endif /* __size_t */
249 #endif /* _SIZET_ */
250 #endif /* _GCC_SIZE_T */
251# HG changeset patch
252# Parent 2b94537ce2496c88e7e797c617e5b95e8d7e4785
253A fix for libgomp to correctly request a POSIX version for time support.
254
255diff -r 2b94537ce249 libgomp/config/posix/time.c
256--- a/libgomp/config/posix/time.c Fri Mar 29 16:41:14 2013 -0400
257+++ b/libgomp/config/posix/time.c Fri Mar 29 16:41:17 2013 -0400
258@@ -28,6 +28,8 @@
259 The following implementation uses the most simple POSIX routines.
260 If present, POSIX 4 clocks should be used instead. */
261
262+#define _POSIX_C_SOURCE 199309L /* for clocks */
263+
264 #include "libgomp.h"
265 #include <unistd.h>
266 #if TIME_WITH_SYS_TIME
267diff -r 2ebb44d1e6f1 libgcc/unwind-dw2-fde-dip.c
268--- a/libgcc/unwind-dw2-fde-dip.c Sun Jul 28 12:15:47 2013 -0400
269+++ b/libgcc/unwind-dw2-fde-dip.c Sun Jul 28 12:17:02 2013 -0400
270@@ -47,28 +47,13 @@
271 #include "unwind-compat.h"
272 #include "gthr.h"
273
274-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
275- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
276- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
277+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
278 # define USE_PT_GNU_EH_FRAME
279-#endif
280-
281-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
282- && defined(__FreeBSD__) && __FreeBSD__ >= 7
283-# define ElfW __ElfN
284-# define USE_PT_GNU_EH_FRAME
285-#endif
286-
287-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
288- && defined(__OpenBSD__)
289-# define ElfW(type) Elf_##type
290-# define USE_PT_GNU_EH_FRAME
291-#endif
292-
293-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
294- && defined(TARGET_DL_ITERATE_PHDR) \
295- && defined(__sun__) && defined(__svr4__)
296-# define USE_PT_GNU_EH_FRAME
297+# ifdef __OpenBSD__
298+# define ElfW(type) Elf_##typ
299+# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
300+# define ElfW __ElfN
301+# endif
302 #endif
303
304 #if defined(USE_PT_GNU_EH_FRAME)
305diff -r 75d9c38318a7 gcc/configure
306--- a/gcc/configure Tue Sep 24 06:52:49 2013 -0400
307+++ b/gcc/configure Tue Sep 24 06:54:33 2013 -0400
308@@ -26736,6 +26736,9 @@
309 else
310 gcc_cv_libc_provides_ssp=no
311 case "$target" in
312+ *-*-musl*)
313+ # All versions of musl provide stack protector
314+ gcc_cv_libc_provides_ssp=yes;;
315 *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
316 # glibc 2.4 and later provides __stack_chk_fail and
317 # either __stack_chk_guard, or TLS access to stack guard canary.
318@@ -26769,6 +26772,7 @@
319 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
320 # simply assert that glibc does provide this, which is true for all
321 # realistically usable GNU/Hurd configurations.
322+ # All supported versions of musl provide it as well
323 gcc_cv_libc_provides_ssp=yes;;
324 *-*-darwin* | *-*-freebsd*)
325 ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
326@@ -26851,6 +26855,9 @@
327 gcc_cv_target_dl_iterate_phdr=no
328 fi
329 ;;
330+ *-linux-musl*)
331+ gcc_cv_target_dl_iterate_phdr=yes
332+ ;;
333 esac
334
335 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
336diff -r 75d9c38318a7 gcc/configure.ac
337--- a/gcc/configure.ac Tue Sep 24 06:52:49 2013 -0400
338+++ b/gcc/configure.ac Tue Sep 24 06:54:33 2013 -0400
339@@ -4719,6 +4719,9 @@
340 gcc_cv_libc_provides_ssp,
341 [gcc_cv_libc_provides_ssp=no
342 case "$target" in
343+ *-*-musl*)
344+ # All versions of musl provide stack protector
345+ gcc_cv_libc_provides_ssp=yes;;
346 *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
347 [# glibc 2.4 and later provides __stack_chk_fail and
348 # either __stack_chk_guard, or TLS access to stack guard canary.
349@@ -4752,6 +4755,7 @@
350 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
351 # simply assert that glibc does provide this, which is true for all
352 # realistically usable GNU/Hurd configurations.
353+ # All supported versions of musl provide it as well
354 gcc_cv_libc_provides_ssp=yes;;
355 *-*-darwin* | *-*-freebsd*)
356 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
357@@ -4817,6 +4821,9 @@
358 gcc_cv_target_dl_iterate_phdr=no
359 fi
360 ;;
361+ *-linux-musl*)
362+ gcc_cv_target_dl_iterate_phdr=yes
363+ ;;
364 esac
365 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
366 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
367# HG changeset patch
368# Parent 94e435662aff38e86c9ca0dff4bbf451e0190b34
369Get rid of ever-broken fixincludes on musl.
370
371
372diff -r 94e435662aff -r e27957848dc8 fixincludes/mkfixinc.sh
373--- a/fixincludes/mkfixinc.sh Sat Jul 27 23:37:20 2013 -0400
374+++ b/fixincludes/mkfixinc.sh Sat Jul 27 23:43:03 2013 -0400
375@@ -19,7 +19,8 @@
376 powerpc-*-eabi* | \
377 powerpc-*-rtems* | \
378 powerpcle-*-eabisim* | \
379- powerpcle-*-eabi* )
380+ powerpcle-*-eabi* | \
381+ *-musl* )
382 # IF there is no include fixing,
383 # THEN create a no-op fixer and exit
384 (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
385# HG changeset patch
386# Parent 65cd23493c45f2a531ca15ffea563d6110143cdd
387New config.sub for GCC versions too early for the update.
388
389
390diff -r 65cd23493c45 -r 355cec477536 config.sub
391--- a/config.sub Tue Aug 27 15:49:27 2013 -0400
392+++ b/config.sub Tue Aug 27 15:51:14 2013 -0400
393@@ -4,7 +4,7 @@
394 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
395 # 2011 Free Software Foundation, Inc.
396
397-timestamp='2011-10-29'
398+timestamp='2011-03-23'
399
400 # This file is (in principle) common to ALL GNU software.
401 # The presence of a machine in this file suggests that SOME GNU software
402@@ -125,6 +125,7 @@
403 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
404 case $maybe_os in
405 nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
406+ linux-musl* | \
407 linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
408 knetbsd*-gnu* | netbsd*-gnu* | \
409 kopensolaris*-gnu* | \
410@@ -251,17 +252,13 @@
411 | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
412 | am33_2.0 \
413 | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
414- | be32 | be64 \
415 | bfin \
416 | c4x | clipper \
417 | d10v | d30v | dlx | dsp16xx \
418- | epiphany \
419 | fido | fr30 | frv \
420 | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
421- | hexagon \
422 | i370 | i860 | i960 | ia64 \
423 | ip2k | iq2000 \
424- | le32 | le64 \
425 | lm32 \
426 | m32c | m32r | m32rle | m68000 | m68k | m88k \
427 | maxq | mb | microblaze | mcore | mep | metag \
428@@ -295,7 +292,7 @@
429 | pdp10 | pdp11 | pj | pjl \
430 | powerpc | powerpc64 | powerpc64le | powerpcle \
431 | pyramid \
432- | rl78 | rx \
433+ | rx \
434 | score \
435 | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
436 | sh64 | sh64le \
437@@ -304,7 +301,7 @@
438 | spu \
439 | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
440 | ubicom32 \
441- | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
442+ | v850 | v850e \
443 | we32k \
444 | x86 | xc16x | xstormy16 | xtensa \
445 | z8k | z80)
446@@ -361,7 +358,6 @@
447 | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
448 | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
449 | avr-* | avr32-* \
450- | be32-* | be64-* \
451 | bfin-* | bs2000-* \
452 | c[123]* | c30-* | [cjt]90-* | c4x-* \
453 | clipper-* | craynv-* | cydra-* \
454@@ -370,10 +366,8 @@
455 | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
456 | h8300-* | h8500-* \
457 | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
458- | hexagon-* \
459 | i*86-* | i860-* | i960-* | ia64-* \
460 | ip2k-* | iq2000-* \
461- | le32-* | le64-* \
462 | lm32-* \
463 | m32c-* | m32r-* | m32rle-* \
464 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
465@@ -407,7 +401,7 @@
466 | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
467 | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
468 | pyramid-* \
469- | rl78-* | romp-* | rs6000-* | rx-* \
470+ | romp-* | rs6000-* | rx-* \
471 | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
472 | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
473 | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
474@@ -415,11 +409,10 @@
475 | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
476 | tahoe-* \
477 | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
478- | tile*-* \
479+ | tile-* | tilegx-* \
480 | tron-* \
481 | ubicom32-* \
482- | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
483- | vax-* \
484+ | v850-* | v850e-* | vax-* \
485 | we32k-* \
486 | x86-* | x86_64-* | xc16x-* | xps100-* \
487 | xstormy16-* | xtensa*-* \
488@@ -820,10 +813,6 @@
489 basic_machine=i370-ibm
490 os=-mvs
491 ;;
492- nacl)
493- basic_machine=le32-unknown
494- os=-nacl
495- ;;
496 ncr3000)
497 basic_machine=i486-ncr
498 os=-sysv4
499@@ -1132,8 +1121,13 @@
500 basic_machine=t90-cray
501 os=-unicos
502 ;;
503+ # This must be matched before tile*.
504+ tilegx*)
505+ basic_machine=tilegx-unknown
506+ os=-linux-gnu
507+ ;;
508 tile*)
509- basic_machine=$basic_machine-unknown
510+ basic_machine=tile-unknown
511 os=-linux-gnu
512 ;;
513 tx39)
514@@ -1346,6 +1340,7 @@
515 | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
516 | -mingw32* | -linux-gnu* | -linux-android* \
517 | -linux-newlib* | -linux-uclibc* \
518+ | -linux-musl* \
519 | -uxpv* | -beos* | -mpeix* | -udk* \
520 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
521 | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
522# HG changeset patch
523# Parent 3ea10cd626cb7abdfd56d3fe8d2c9ed58a82797b
524Support for i386-linux-musl and x86_64-linux-musl.
525
526diff -r 3ea10cd626cb gcc/config/i386/linux.h
527--- a/gcc/config/i386/linux.h Fri Mar 29 16:41:17 2013 -0400
528+++ b/gcc/config/i386/linux.h Fri Mar 29 16:41:20 2013 -0400
529@@ -21,3 +21,4 @@
530
531 #define GNU_USER_LINK_EMULATION "elf_i386"
532 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
533+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
534diff -r 3ea10cd626cb gcc/config/i386/linux64.h
535--- a/gcc/config/i386/linux64.h Fri Mar 29 16:41:17 2013 -0400
536+++ b/gcc/config/i386/linux64.h Fri Mar 29 16:41:20 2013 -0400
537@@ -30,3 +30,7 @@
538 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
539 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
540 #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
541+
542+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
543+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
544+#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
545diff -r 3ea10cd626cb libitm/config/linux/x86/tls.h
546--- a/libitm/config/linux/x86/tls.h Fri Mar 29 16:41:17 2013 -0400
547+++ b/libitm/config/linux/x86/tls.h Fri Mar 29 16:41:20 2013 -0400
548@@ -25,16 +25,19 @@
549 #ifndef LIBITM_X86_TLS_H
550 #define LIBITM_X86_TLS_H 1
551
552-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
553+#if defined(__GLIBC_PREREQ)
554+#if __GLIBC_PREREQ(2, 10)
555 /* Use slots in the TCB head rather than __thread lookups.
556 GLIBC has reserved words 10 through 13 for TM. */
557 #define HAVE_ARCH_GTM_THREAD 1
558 #define HAVE_ARCH_GTM_THREAD_DISP 1
559 #endif
560+#endif
561
562 #include "config/generic/tls.h"
563
564-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
565+#if defined(__GLIBC_PREREQ)
566+#if __GLIBC_PREREQ(2, 10)
567 namespace GTM HIDDEN {
568
569 #ifdef __x86_64__
570@@ -101,5 +104,6 @@
571
572 } // namespace GTM
573 #endif /* >= GLIBC 2.10 */
574+#endif
575
576 #endif // LIBITM_X86_TLS_H
577Support for arm-linux-musl.
578
579diff -r 8801a3f6d050 gcc/config/arm/linux-eabi.h
580--- a/gcc/config/arm/linux-eabi.h Tue Aug 27 15:47:31 2013 -0400
581+++ b/gcc/config/arm/linux-eabi.h Tue Aug 27 15:47:37 2013 -0400
582@@ -64,6 +64,23 @@
583 #undef GLIBC_DYNAMIC_LINKER
584 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
585
586+/* For ARM musl currently supports four dynamic linkers:
587+ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
588+ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
589+ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
590+ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
591+ musl does not support the legacy OABI mode.
592+ All the dynamic linkers live in /lib.
593+ We default to soft-float, EL. */
594+#undef MUSL_DYNAMIC_LINKER
595+#if TARGET_BIG_ENDIAN_DEFAULT
596+#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
597+#else
598+#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
599+#endif
600+#define MUSL_DYNAMIC_LINKER \
601+ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
602+
603 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
604 use the GNU/Linux version, not the generic BPABI version. */
605 #undef LINK_SPEC
606diff -r 8801a3f6d050 libitm/config/arm/hwcap.cc
607--- a/libitm/config/arm/hwcap.cc Tue Aug 27 15:47:31 2013 -0400
608+++ b/libitm/config/arm/hwcap.cc Tue Aug 27 15:47:37 2013 -0400
609@@ -40,7 +40,11 @@
610
611 #ifdef __linux__
612 #include <unistd.h>
613+#ifdef __GLIBC__
614 #include <sys/fcntl.h>
615+#else
616+#include <fcntl.h>
617+#endif
618 #include <elf.h>
619
620 static void __attribute__((constructor))
621# HG changeset patch
622# Parent 4618ad6f036f1e944a5262ae5875dcdf62c41f8b
623Support for mips-linux-musl.
624
625diff -r 4618ad6f036f gcc/config/mips/linux.h
626--- a/gcc/config/mips/linux.h Thu Sep 19 08:56:47 2013 -0400
627+++ b/gcc/config/mips/linux.h Thu Sep 19 09:08:11 2013 -0400
628@@ -18,3 +18,10 @@
629 <http://www.gnu.org/licenses/>. */
630
631 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
632+
633+#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
634+#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
635+#else
636+#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
637+#endif
638+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1"
639# HG changeset patch
640# Parent 2ffe76b215fdb082cbbc262536077627757fa9bf
641Support for powerpc-linux-musl.
642
643diff -r 2ffe76b215fd gcc/config.gcc
644--- a/gcc/config.gcc Fri Mar 29 16:41:26 2013 -0400
645+++ b/gcc/config.gcc Fri Mar 29 16:41:28 2013 -0400
646@@ -2112,6 +2112,10 @@
647 powerpc*-*-linux*paired*)
648 tm_file="${tm_file} rs6000/750cl.h" ;;
649 esac
650+ case ${target} in
651+ *-linux*-musl*)
652+ enable_secureplt=yes ;;
653+ esac
654 if test x${enable_secureplt} = xyes; then
655 tm_file="rs6000/secureplt.h ${tm_file}"
656 fi
657diff -r 2ffe76b215fd gcc/config/rs6000/linux64.h
658--- a/gcc/config/rs6000/linux64.h Fri Mar 29 16:41:26 2013 -0400
659+++ b/gcc/config/rs6000/linux64.h Fri Mar 29 16:41:28 2013 -0400
660@@ -364,17 +364,21 @@
661 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
662 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
663 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
664+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
665+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
666 #if DEFAULT_LIBC == LIBC_UCLIBC
667-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
668+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
669 #elif DEFAULT_LIBC == LIBC_GLIBC
670-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
671+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
672+#elif DEFAULT_LIBC == LIBC_MUSL
673+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
674 #else
675 #error "Unsupported DEFAULT_LIBC"
676 #endif
677 #define GNU_USER_DYNAMIC_LINKER32 \
678- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
679+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
680 #define GNU_USER_DYNAMIC_LINKER64 \
681- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
682+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
683
684
685 #define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
686diff -r 2ffe76b215fd gcc/config/rs6000/secureplt.h
687--- a/gcc/config/rs6000/secureplt.h Fri Mar 29 16:41:26 2013 -0400
688+++ b/gcc/config/rs6000/secureplt.h Fri Mar 29 16:41:28 2013 -0400
689@@ -18,3 +18,4 @@
690 <http://www.gnu.org/licenses/>. */
691
692 #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
693+#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
694diff -r 2ffe76b215fd gcc/config/rs6000/sysv4.h
695--- a/gcc/config/rs6000/sysv4.h Fri Mar 29 16:41:26 2013 -0400
696+++ b/gcc/config/rs6000/sysv4.h Fri Mar 29 16:41:28 2013 -0400
697@@ -551,6 +551,9 @@
698 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
699 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
700 #endif
701+#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
702+#define LINK_SECURE_PLT_DEFAULT_SPEC ""
703+#endif
704
705 /* Pass -G xxx to the compiler and set correct endian mode. */
706 #define CC1_SPEC "%{G*} %(cc1_cpu) \
707@@ -611,7 +614,8 @@
708 %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
709 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
710 %{mcall-i960-old: --oformat elf32-powerpcle} \
711- }}}}"
712+ }}}} \
713+%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
714
715 /* Any specific OS flags. */
716 #define LINK_OS_SPEC "\
717@@ -789,15 +793,18 @@
718
719 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
720 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
721+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
722 #if DEFAULT_LIBC == LIBC_UCLIBC
723-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
724+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
725+#elif DEFAULT_LIBC == LIBC_MUSL
726+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
727 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
728-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
729+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
730 #else
731 #error "Unsupported DEFAULT_LIBC"
732 #endif
733 #define GNU_USER_DYNAMIC_LINKER \
734- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
735+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
736
737 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
738 %{rdynamic:-export-dynamic} \
739@@ -923,6 +930,7 @@
740 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
741 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
742 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
743+ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
744 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
745 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
746 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
Note: See TracBrowser for help on using the repository browser.