1 diff -Nur gcc-4.7.3.orig/config.sub gcc-4.7.3/config.sub
2 --- gcc-4.7.3.orig/config.sub 2012-08-06 16:34:27.000000000 +0200
3 +++ gcc-4.7.3/config.sub 2013-09-16 15:39:42.000000000 +0200
5 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
6 # 2011 Free Software Foundation, Inc.
8 -timestamp='2011-10-29'
9 +timestamp='2011-03-23'
11 # This file is (in principle) common to ALL GNU software.
12 # The presence of a machine in this file suggests that SOME GNU software
14 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
16 nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
18 linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
19 knetbsd*-gnu* | netbsd*-gnu* | \
20 kopensolaris*-gnu* | \
22 | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
24 | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
28 | d10v | d30v | dlx | dsp16xx \
31 | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
33 | i370 | i860 | i960 | ia64 \
37 | m32c | m32r | m32rle | m68000 | m68k | m88k \
38 | maxq | mb | microblaze | mcore | mep | metag \
40 | pdp10 | pdp11 | pj | pjl \
41 | powerpc | powerpc64 | powerpc64le | powerpcle \
46 | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
50 | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
52 - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
55 | x86 | xc16x | xstormy16 | xtensa \
58 | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
59 | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
63 | c[123]* | c30-* | [cjt]90-* | c4x-* \
64 | clipper-* | craynv-* | cydra-* \
66 | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
68 | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
70 | i*86-* | i860-* | i960-* | ia64-* \
74 | m32c-* | m32r-* | m32rle-* \
75 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
77 | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
78 | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
80 - | rl78-* | romp-* | rs6000-* | rx-* \
81 + | romp-* | rs6000-* | rx-* \
82 | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
83 | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
84 | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
86 | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
88 | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
90 + | tile-* | tilegx-* \
93 - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
95 + | v850-* | v850e-* | vax-* \
97 | x86-* | x86_64-* | xc16x-* | xps100-* \
98 | xstormy16-* | xtensa*-* \
100 basic_machine=i370-ibm
104 - basic_machine=le32-unknown
108 basic_machine=i486-ncr
110 @@ -1132,8 +1121,13 @@
111 basic_machine=t90-cray
114 + # This must be matched before tile*.
116 + basic_machine=tilegx-unknown
120 - basic_machine=$basic_machine-unknown
121 + basic_machine=tile-unknown
125 @@ -1346,6 +1340,7 @@
126 | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
127 | -mingw32* | -linux-gnu* | -linux-android* \
128 | -linux-newlib* | -linux-uclibc* \
130 | -uxpv* | -beos* | -mpeix* | -udk* \
131 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
132 | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
133 diff -Nur gcc-4.7.3.orig/fixincludes/mkfixinc.sh gcc-4.7.3/fixincludes/mkfixinc.sh
134 --- gcc-4.7.3.orig/fixincludes/mkfixinc.sh 2011-09-22 16:00:17.000000000 +0200
135 +++ gcc-4.7.3/fixincludes/mkfixinc.sh 2013-09-16 15:39:42.000000000 +0200
139 powerpcle-*-eabisim* | \
140 - powerpcle-*-eabi* )
141 + powerpcle-*-eabi* | \
143 # IF there is no include fixing,
144 # THEN create a no-op fixer and exit
145 (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
146 diff -Nur gcc-4.7.3.orig/gcc/config/arm/linux-eabi.h gcc-4.7.3/gcc/config/arm/linux-eabi.h
147 --- gcc-4.7.3.orig/gcc/config/arm/linux-eabi.h 2011-11-02 16:03:19.000000000 +0100
148 +++ gcc-4.7.3/gcc/config/arm/linux-eabi.h 2013-09-16 15:39:42.000000000 +0200
150 #undef GLIBC_DYNAMIC_LINKER
151 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
153 +/* For ARM musl currently supports two dynamic linkers:
154 + - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
155 + - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI.
156 + musl does not support the legacy OABI (i.e. broken) mode.
157 + All the dynamic linkers live in /lib.
158 + We default to soft-float, but this can be overridden by changing both
159 + MUSL_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
160 +#undef MUSL_DYNAMIC_LINKER
161 +#define MUSL_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-musl-arm.so.1"
162 +#define MUSL_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-musl-armhf.so.1"
163 +#define MUSL_DYNAMIC_LINKER_DEFAULT MUSL_DYNAMIC_LINKER_SOFT_FLOAT
165 +#define MUSL_DYNAMIC_LINKER \
166 + "%{mfloat-abi=hard:" MUSL_DYNAMIC_LINKER_HARD_FLOAT "} \
167 + %{mfloat-abi=soft*:" MUSL_DYNAMIC_LINKER_SOFT_FLOAT "} \
168 + %{!mfloat-abi=*:" MUSL_DYNAMIC_LINKER_DEFAULT "}"
170 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
171 use the GNU/Linux version, not the generic BPABI version. */
173 diff -Nur gcc-4.7.3.orig/gcc/config/i386/linux64.h gcc-4.7.3/gcc/config/i386/linux64.h
174 --- gcc-4.7.3.orig/gcc/config/i386/linux64.h 2011-07-07 17:38:34.000000000 +0200
175 +++ gcc-4.7.3/gcc/config/i386/linux64.h 2013-09-16 15:39:42.000000000 +0200
177 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
178 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
179 #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
181 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
182 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
183 +#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
184 diff -Nur gcc-4.7.3.orig/gcc/config/i386/linux.h gcc-4.7.3/gcc/config/i386/linux.h
185 --- gcc-4.7.3.orig/gcc/config/i386/linux.h 2011-06-03 20:30:39.000000000 +0200
186 +++ gcc-4.7.3/gcc/config/i386/linux.h 2013-09-16 15:39:42.000000000 +0200
189 #define GNU_USER_LINK_EMULATION "elf_i386"
190 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
191 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
192 diff -Nur gcc-4.7.3.orig/gcc/config/linux.h gcc-4.7.3/gcc/config/linux.h
193 --- gcc-4.7.3.orig/gcc/config/linux.h 2012-08-14 15:59:04.000000000 +0200
194 +++ gcc-4.7.3/gcc/config/linux.h 2013-09-16 15:39:42.000000000 +0200
196 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
197 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
198 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
199 +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
201 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
202 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
203 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
204 +#define OPTION_MUSL (linux_libc == LIBC_MUSL)
207 #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
209 uClibc or Bionic is the default C library and whether
210 -muclibc or -mglibc or -mbionic has been passed to change the default. */
212 -#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
213 - "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
214 +#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
215 + "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
217 #if DEFAULT_LIBC == LIBC_GLIBC
218 -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
219 - CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
220 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
221 + CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
222 #elif DEFAULT_LIBC == LIBC_UCLIBC
223 -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
224 - CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
225 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
226 + CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
227 #elif DEFAULT_LIBC == LIBC_BIONIC
228 -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
229 - CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
230 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
231 + CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
232 +#elif DEFAULT_LIBC == LIBC_MUSL
233 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
234 + CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
236 #error "Unsupported DEFAULT_LIBC"
237 #endif /* DEFAULT_LIBC */
240 #define GNU_USER_DYNAMIC_LINKER \
241 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
242 - BIONIC_DYNAMIC_LINKER)
243 + BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
244 #define GNU_USER_DYNAMIC_LINKER32 \
245 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
246 - BIONIC_DYNAMIC_LINKER32)
247 + BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
248 #define GNU_USER_DYNAMIC_LINKER64 \
249 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
250 - BIONIC_DYNAMIC_LINKER64)
251 + BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
252 #define GNU_USER_DYNAMIC_LINKERX32 \
253 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
254 - BIONIC_DYNAMIC_LINKERX32)
255 + BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
257 /* Determine whether the entire c99 runtime
258 is present in the runtime library. */
259 #undef TARGET_C99_FUNCTIONS
260 -#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
261 +#define TARGET_C99_FUNCTIONS (OPTION_GLIBC || OPTION_MUSL)
263 /* Whether we have sincos that follows the GNU extension. */
264 #undef TARGET_HAS_SINCOS
266 /* Whether we have Bionic libc runtime */
267 #undef TARGET_HAS_BIONIC
268 #define TARGET_HAS_BIONIC (OPTION_BIONIC)
270 +/* musl avoids problematic includes by rearranging the include directories.
271 + * Unfortunately, this is mostly duplicated from cppdefault.c */
272 +#if DEFAULT_LIBC == LIBC_MUSL
273 +#define INCLUDE_DEFAULTS_MUSL_GPP \
274 + { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
275 + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
276 + { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
277 + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
278 + { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
279 + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
281 +#ifdef LOCAL_INCLUDE_DIR
282 +#define INCLUDE_DEFAULTS_MUSL_LOCAL \
283 + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
284 + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
286 +#define INCLUDE_DEFAULTS_MUSL_LOCAL
289 +#ifdef PREFIX_INCLUDE_DIR
290 +#define INCLUDE_DEFAULTS_MUSL_PREFIX \
291 + { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
293 +#define INCLUDE_DEFAULTS_MUSL_PREFIX
296 +#ifdef CROSS_INCLUDE_DIR
297 +#define INCLUDE_DEFAULTS_MUSL_CROSS \
298 + { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
300 +#define INCLUDE_DEFAULTS_MUSL_CROSS
303 +#ifdef TOOL_INCLUDE_DIR
304 +#define INCLUDE_DEFAULTS_MUSL_TOOL \
305 + { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
307 +#define INCLUDE_DEFAULTS_MUSL_TOOL
310 +#ifdef NATIVE_SYSTEM_HEADER_DIR
311 +#define INCLUDE_DEFAULTS_MUSL_NATIVE \
312 + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
313 + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
315 +#define INCLUDE_DEFAULTS_MUSL_NATIVE
318 +#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
319 +# undef INCLUDE_DEFAULTS_MUSL_LOCAL
320 +# define INCLUDE_DEFAULTS_MUSL_LOCAL
321 +# undef INCLUDE_DEFAULTS_MUSL_NATIVE
322 +# define INCLUDE_DEFAULTS_MUSL_NATIVE
324 +# undef INCLUDE_DEFAULTS_MUSL_CROSS
325 +# define INCLUDE_DEFAULTS_MUSL_CROSS
328 +#undef INCLUDE_DEFAULTS
329 +#define INCLUDE_DEFAULTS \
331 + INCLUDE_DEFAULTS_MUSL_GPP \
332 + INCLUDE_DEFAULTS_MUSL_PREFIX \
333 + INCLUDE_DEFAULTS_MUSL_CROSS \
334 + INCLUDE_DEFAULTS_MUSL_TOOL \
335 + INCLUDE_DEFAULTS_MUSL_NATIVE \
336 + { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
337 + { 0, 0, 0, 0, 0, 0 } \
340 diff -Nur gcc-4.7.3.orig/gcc/config/linux.opt gcc-4.7.3/gcc/config/linux.opt
341 --- gcc-4.7.3.orig/gcc/config/linux.opt 2010-09-29 16:51:52.000000000 +0200
342 +++ gcc-4.7.3/gcc/config/linux.opt 2013-09-16 15:39:42.000000000 +0200
345 Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
349 +Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
351 diff -Nur gcc-4.7.3.orig/gcc/config/mips/linux.h gcc-4.7.3/gcc/config/mips/linux.h
352 --- gcc-4.7.3.orig/gcc/config/mips/linux.h 2011-07-19 20:00:27.000000000 +0200
353 +++ gcc-4.7.3/gcc/config/mips/linux.h 2013-09-16 15:39:43.000000000 +0200
355 <http://www.gnu.org/licenses/>. */
357 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
359 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
360 diff -Nur gcc-4.7.3.orig/gcc/config/rs6000/linux64.h gcc-4.7.3/gcc/config/rs6000/linux64.h
361 --- gcc-4.7.3.orig/gcc/config/rs6000/linux64.h 2012-03-12 17:16:51.000000000 +0100
362 +++ gcc-4.7.3/gcc/config/rs6000/linux64.h 2013-09-16 15:39:43.000000000 +0200
363 @@ -362,17 +362,21 @@
364 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
365 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
366 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
367 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
368 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
369 #if DEFAULT_LIBC == LIBC_UCLIBC
370 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
371 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
372 #elif DEFAULT_LIBC == LIBC_GLIBC
373 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
374 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
375 +#elif DEFAULT_LIBC == LIBC_MUSL
376 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
378 #error "Unsupported DEFAULT_LIBC"
380 #define GNU_USER_DYNAMIC_LINKER32 \
381 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
382 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
383 #define GNU_USER_DYNAMIC_LINKER64 \
384 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
385 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
388 #define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
389 diff -Nur gcc-4.7.3.orig/gcc/config/rs6000/sysv4.h gcc-4.7.3/gcc/config/rs6000/sysv4.h
390 --- gcc-4.7.3.orig/gcc/config/rs6000/sysv4.h 2012-04-30 19:39:01.000000000 +0200
391 +++ gcc-4.7.3/gcc/config/rs6000/sysv4.h 2013-09-16 15:39:43.000000000 +0200
392 @@ -804,15 +808,18 @@
394 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
395 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
396 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
397 #if DEFAULT_LIBC == LIBC_UCLIBC
398 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
399 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
400 +#elif DEFAULT_LIBC == LIBC_MUSL
401 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
402 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
403 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
404 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
406 #error "Unsupported DEFAULT_LIBC"
408 #define GNU_USER_DYNAMIC_LINKER \
409 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
410 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
412 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
413 %{rdynamic:-export-dynamic} \
414 diff -Nur gcc-4.7.3.orig/gcc/config.gcc gcc-4.7.3/gcc/config.gcc
415 --- gcc-4.7.3.orig/gcc/config.gcc 2013-03-06 23:54:11.000000000 +0100
416 +++ gcc-4.7.3/gcc/config.gcc 2013-09-16 15:39:43.000000000 +0200
420 # Common C libraries.
421 -tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
422 +tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
424 # Common parts for widely ported systems.
428 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
431 + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
434 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
436 @@ -2092,6 +2095,10 @@
437 powerpc*-*-linux*paired*)
438 tm_file="${tm_file} rs6000/750cl.h" ;;
442 + enable_secureplt=yes ;;
444 if test x${enable_secureplt} = xyes; then
445 tm_file="rs6000/secureplt.h ${tm_file}"
447 diff -Nur gcc-4.7.3.orig/gcc/configure gcc-4.7.3/gcc/configure
448 --- gcc-4.7.3.orig/gcc/configure 2013-02-06 16:23:55.000000000 +0100
449 +++ gcc-4.7.3/gcc/configure 2013-09-16 15:39:43.000000000 +0200
450 @@ -26815,7 +26815,8 @@
451 gcc_cv_libc_provides_ssp=yes
457 # Avoid complicated tests (see
458 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
459 # simply assert that glibc does provide this, which is true for all
460 @@ -26902,6 +26903,9 @@
461 gcc_cv_target_dl_iterate_phdr=no
465 + gcc_cv_target_dl_iterate_phdr=yes
469 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
470 diff -Nur gcc-4.7.3.orig/gcc/configure.ac gcc-4.7.3/gcc/configure.ac
471 --- gcc-4.7.3.orig/gcc/configure.ac 2013-02-06 16:23:55.000000000 +0100
472 +++ gcc-4.7.3/gcc/configure.ac 2013-09-16 15:39:43.000000000 +0200
473 @@ -4692,7 +4692,8 @@
474 gcc_cv_libc_provides_ssp=yes
480 # Avoid complicated tests (see
481 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
482 # simply assert that glibc does provide this, which is true for all
483 @@ -4762,6 +4763,9 @@
484 gcc_cv_target_dl_iterate_phdr=no
488 + gcc_cv_target_dl_iterate_phdr=yes
491 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
492 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
493 diff -Nur gcc-4.7.3.orig/gcc/ginclude/stddef.h gcc-4.7.3/gcc/ginclude/stddef.h
494 --- gcc-4.7.3.orig/gcc/ginclude/stddef.h 2012-02-12 02:06:04.000000000 +0100
495 +++ gcc-4.7.3/gcc/ginclude/stddef.h 2013-09-16 15:39:43.000000000 +0200
500 +#ifndef __DEFINED_size_t /* musl */
501 #define __size_t__ /* BeOS */
502 #define __SIZE_T__ /* Cray Unicos/Mk */
505 #define ___int_size_t_h
508 +#define __DEFINED_size_t /* musl */
509 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
510 || defined(__FreeBSD_kernel__)
511 /* __size_t is a typedef on FreeBSD 5, must not trash it. */
513 typedef long ssize_t;
514 #endif /* __BEOS__ */
515 #endif /* !(defined (__GNUG__) && defined (size_t)) */
516 +#endif /* __DEFINED_size_t */
517 #endif /* __size_t */
519 #endif /* _GCC_SIZE_T */
520 diff -Nur gcc-4.7.3.orig/libgcc/unwind-dw2-fde-dip.c gcc-4.7.3/libgcc/unwind-dw2-fde-dip.c
521 --- gcc-4.7.3.orig/libgcc/unwind-dw2-fde-dip.c 2012-10-06 23:55:06.000000000 +0200
522 +++ gcc-4.7.3/libgcc/unwind-dw2-fde-dip.c 2013-09-16 15:39:43.000000000 +0200
524 #include "unwind-compat.h"
527 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
528 - && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
529 - || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
530 -# define USE_PT_GNU_EH_FRAME
533 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
534 - && defined(__FreeBSD__) && __FreeBSD__ >= 7
535 -# define ElfW __ElfN
536 -# define USE_PT_GNU_EH_FRAME
539 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
540 - && defined(__OpenBSD__)
541 -# define ElfW(type) Elf_##type
542 -# define USE_PT_GNU_EH_FRAME
545 -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
546 - && defined(TARGET_DL_ITERATE_PHDR) \
547 - && defined(__sun__) && defined(__svr4__)
548 +#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
549 # define USE_PT_GNU_EH_FRAME
551 +# define ElfW(type) Elf_##typ
552 +# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
553 +# define ElfW __ElfN
557 #if defined(USE_PT_GNU_EH_FRAME)
558 diff -Nur gcc-4.7.3.orig/libgomp/config/posix/time.c gcc-4.7.3/libgomp/config/posix/time.c
559 --- gcc-4.7.3.orig/libgomp/config/posix/time.c 2009-04-09 17:00:19.000000000 +0200
560 +++ gcc-4.7.3/libgomp/config/posix/time.c 2013-09-16 15:39:43.000000000 +0200
562 The following implementation uses the most simple POSIX routines.
563 If present, POSIX 4 clocks should be used instead. */
565 +#define _POSIX_C_SOURCE 199309L /* for clocks */
569 #if TIME_WITH_SYS_TIME
570 diff -Nur gcc-4.7.3.orig/libitm/config/arm/hwcap.cc gcc-4.7.3/libitm/config/arm/hwcap.cc
571 --- gcc-4.7.3.orig/libitm/config/arm/hwcap.cc 2011-12-15 04:24:05.000000000 +0100
572 +++ gcc-4.7.3/libitm/config/arm/hwcap.cc 2013-09-16 15:39:43.000000000 +0200
578 #include <sys/fcntl.h>
584 static void __attribute__((constructor))
585 diff -Nur gcc-4.7.3.orig/libitm/config/linux/x86/tls.h gcc-4.7.3/libitm/config/linux/x86/tls.h
586 --- gcc-4.7.3.orig/libitm/config/linux/x86/tls.h 2011-11-08 12:13:41.000000000 +0100
587 +++ gcc-4.7.3/libitm/config/linux/x86/tls.h 2013-09-16 15:39:43.000000000 +0200
589 #ifndef LIBITM_X86_TLS_H
590 #define LIBITM_X86_TLS_H 1
592 -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
593 +#if defined(__GLIBC_PREREQ)
594 +#if __GLIBC_PREREQ(2, 10)
595 /* Use slots in the TCB head rather than __thread lookups.
596 GLIBC has reserved words 10 through 13 for TM. */
597 #define HAVE_ARCH_GTM_THREAD 1
598 #define HAVE_ARCH_GTM_THREAD_DISP 1
602 #include "config/generic/tls.h"
604 -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
605 +#if defined(__GLIBC_PREREQ)
606 +#if __GLIBC_PREREQ(2, 10)
607 namespace GTM HIDDEN {
613 #endif /* >= GLIBC 2.10 */
616 #endif // LIBITM_X86_TLS_H
617 diff -Nur gcc-4.7.3.orig/libssp/configure gcc-4.7.3/libssp/configure
618 --- gcc-4.7.3.orig/libssp/configure 2012-08-06 16:34:27.000000000 +0200
619 +++ gcc-4.7.3/libssp/configure 2013-09-16 15:39:43.000000000 +0200
621 ssp_have_usable_vsnprintf
624 +LIBSSP_IN_LIBC_FALSE
626 LIBSSP_USE_SYMVER_SUN_FALSE
627 LIBSSP_USE_SYMVER_SUN_TRUE
628 LIBSSP_USE_SYMVER_GNU_FALSE
631 enable_dependency_tracking
637 @@ -1374,6 +1377,7 @@
638 --disable-dependency-tracking speeds up one-time build
639 --enable-dependency-tracking do not reject slow dependency extractors
640 --disable-symvers disable symbol versioning for libssp
641 + --enable-ssp-in-libc do not build SSP, as it is in libc
642 --enable-shared[=PKGS] build shared libraries [default=yes]
643 --enable-static[=PKGS] build static libraries [default=yes]
644 --enable-fast-install[=PKGS]
645 @@ -4206,6 +4210,36 @@
649 +# musl provides libssp in libc
650 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libssp is provided in libc" >&5
651 +$as_echo_n "checking whether libssp is provided in libc... " >&6; }
652 +# Check whether --enable-ssp_in_libc was given.
653 +if test "${enable_ssp_in_libc+set}" = set; then :
654 + enableval=$enable_ssp_in_libc; ssp_in_libc=$enableval
659 +if test "x$ssp_in_libc" = "xcheck"; then
670 + if test "x$ssp_in_libc" = xyes; then
671 + LIBSSP_IN_LIBC_TRUE=
672 + LIBSSP_IN_LIBC_FALSE='#'
674 + LIBSSP_IN_LIBC_TRUE='#'
675 + LIBSSP_IN_LIBC_FALSE=
680 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
681 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
682 @@ -10650,7 +10684,7 @@
683 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
684 lt_status=$lt_dlunknown
685 cat > conftest.$ac_ext <<_LT_EOF
686 -#line 10653 "configure"
687 +#line 10687 "configure"
688 #include "confdefs.h"
691 @@ -10756,7 +10790,7 @@
692 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
693 lt_status=$lt_dlunknown
694 cat > conftest.$ac_ext <<_LT_EOF
695 -#line 10759 "configure"
696 +#line 10793 "configure"
697 #include "confdefs.h"
700 @@ -11185,6 +11219,10 @@
701 as_fn_error "conditional \"LIBSSP_USE_SYMVER_SUN\" was never defined.
702 Usually this means the macro was only invoked conditionally." "$LINENO" 5
704 +if test -z "${LIBSSP_IN_LIBC_TRUE}" && test -z "${LIBSSP_IN_LIBC_FALSE}"; then
705 + as_fn_error "conditional \"LIBSSP_IN_LIBC\" was never defined.
706 +Usually this means the macro was only invoked conditionally." "$LINENO" 5
709 : ${CONFIG_STATUS=./config.status}
711 diff -Nur gcc-4.7.3.orig/libssp/configure.ac gcc-4.7.3/libssp/configure.ac
712 --- gcc-4.7.3.orig/libssp/configure.ac 2012-05-31 20:59:34.000000000 +0200
713 +++ gcc-4.7.3/libssp/configure.ac 2013-09-16 15:39:43.000000000 +0200
715 AM_CONDITIONAL(LIBSSP_USE_SYMVER_GNU, [test "x$ssp_use_symver" = xgnu])
716 AM_CONDITIONAL(LIBSSP_USE_SYMVER_SUN, [test "x$ssp_use_symver" = xsun])
718 +# musl provides libssp in libc
719 +AC_MSG_CHECKING([whether libssp is provided in libc])
720 +AC_ARG_ENABLE(ssp_in_libc,
721 +AC_HELP_STRING([--enable-ssp-in-libc],
722 + [do not build SSP, as it is in libc]),
723 +ssp_in_libc=$enableval,
725 +if test "x$ssp_in_libc" = "xcheck"; then
736 +AM_CONDITIONAL(LIBSSP_IN_LIBC, [test "x$ssp_in_libc" = xyes])
738 AC_CHECK_HEADERS(alloca.h malloc.h paths.h syslog.h string.h unistd.h fcntl.h stdio.h limits.h)
740 if test x$gcc_no_link = xyes; then
741 diff -Nur gcc-4.7.3.orig/libssp/Makefile.am gcc-4.7.3/libssp/Makefile.am
742 --- gcc-4.7.3.orig/libssp/Makefile.am 2010-12-06 01:50:04.000000000 +0100
743 +++ gcc-4.7.3/libssp/Makefile.am 2013-09-16 15:39:43.000000000 +0200
749 +toolexeclib_LTLIBRARIES = libssp_nonshared.la
751 toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
754 target_noncanonical = @target_noncanonical@
755 libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
756 diff -Nur gcc-4.7.3.orig/libssp/Makefile.in gcc-4.7.3/libssp/Makefile.in
757 --- gcc-4.7.3.orig/libssp/Makefile.in 2011-02-13 12:45:53.000000000 +0100
758 +++ gcc-4.7.3/libssp/Makefile.in 2013-09-16 15:39:43.000000000 +0200
760 libssp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
761 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
762 $(libssp_la_LDFLAGS) $(LDFLAGS) -o $@
763 +@LIBSSP_IN_LIBC_FALSE@am_libssp_la_rpath = -rpath $(toolexeclibdir)
764 am_libssp_nonshared_la_OBJECTS = libssp_nonshared_la-ssp-local.lo
765 libssp_nonshared_la_OBJECTS = $(am_libssp_nonshared_la_OBJECTS)
766 libssp_nonshared_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
767 $(LIBTOOLFLAGS) --mode=link $(CCLD) \
768 $(libssp_nonshared_la_CFLAGS) $(CFLAGS) \
769 $(libssp_nonshared_la_LDFLAGS) $(LDFLAGS) -o $@
770 +@LIBSSP_IN_LIBC_FALSE@am_libssp_nonshared_la_rpath = -rpath \
771 +@LIBSSP_IN_LIBC_FALSE@ $(toolexeclibdir)
772 +@LIBSSP_IN_LIBC_TRUE@am_libssp_nonshared_la_rpath = -rpath \
773 +@LIBSSP_IN_LIBC_TRUE@ $(toolexeclibdir)
774 DEFAULT_INCLUDES = -I.@am__isrc@
775 depcomp = $(SHELL) $(top_srcdir)/../depcomp
776 am__depfiles_maybe = depfiles
778 @LIBSSP_USE_SYMVER_GNU_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = $(srcdir)/ssp.map
779 @LIBSSP_USE_SYMVER_SUN_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = ssp.map-sun
781 -toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
782 +@LIBSSP_IN_LIBC_FALSE@toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
783 +@LIBSSP_IN_LIBC_TRUE@toolexeclib_LTLIBRARIES = libssp_nonshared.la
784 libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
785 nobase_libsubinclude_HEADERS = ssp/ssp.h ssp/string.h ssp/stdio.h ssp/unistd.h
786 libssp_la_SOURCES = \
788 rm -f "$${dir}/so_locations"; \
790 libssp.la: $(libssp_la_OBJECTS) $(libssp_la_DEPENDENCIES)
791 - $(libssp_la_LINK) -rpath $(toolexeclibdir) $(libssp_la_OBJECTS) $(libssp_la_LIBADD) $(LIBS)
792 + $(libssp_la_LINK) $(am_libssp_la_rpath) $(libssp_la_OBJECTS) $(libssp_la_LIBADD) $(LIBS)
793 libssp_nonshared.la: $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_DEPENDENCIES)
794 - $(libssp_nonshared_la_LINK) -rpath $(toolexeclibdir) $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_LIBADD) $(LIBS)
795 + $(libssp_nonshared_la_LINK) $(am_libssp_nonshared_la_rpath) $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_LIBADD) $(LIBS)
799 diff -Nur gcc-4.7.3.orig/libstdc++-v3/configure.host gcc-4.7.3/libstdc++-v3/configure.host
800 --- gcc-4.7.3.orig/libstdc++-v3/configure.host 2012-12-18 15:27:14.000000000 +0100
801 +++ gcc-4.7.3/libstdc++-v3/configure.host 2013-09-16 15:39:43.000000000 +0200
803 os_include_dir="os/bsd/freebsd"
805 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
806 + # check for musl by target
807 + case "${host_os}" in
809 + os_include_dir="os/generic"
813 if [ "$uclibc" = "yes" ]; then
814 os_include_dir="os/uclibc"
815 elif [ "$bionic" = "yes" ]; then
817 os_include_dir="os/gnu-linux"
824 os_include_dir="os/hpux"