bump musl default version to 1.1.20
[rofl0r-mmix-cross.git] / patches / gcc-4.6.4-musl.diff
blob8ec8befa25d68eb2abb5872f401d3421ef801509
1 # HG changeset patch
2 # Parent 05e4cf5f033d266c8f8fe065f8c5752891c5bf7a
3 Adding musl to config.sub, so it's recognized as a target platform.
6 diff -r 05e4cf5f033d -r 04a6a82b8e06 config.sub
7 --- a/config.sub Wed Nov 21 21:16:07 2012 -0500
8 +++ b/config.sub Wed Nov 21 21:16:58 2012 -0500
9 @@ -125,6 +125,7 @@
10 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
11 case $maybe_os in
12 nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
13 + linux-musl* | \
14 linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
15 knetbsd*-gnu* | netbsd*-gnu* | \
16 kopensolaris*-gnu* | \
17 @@ -1346,6 +1347,7 @@
18 | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
19 | -mingw32* | -linux-gnu* | -linux-android* \
20 | -linux-newlib* | -linux-uclibc* \
21 + | -linux-musl* \
22 | -uxpv* | -beos* | -mpeix* | -udk* \
23 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
24 | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
25 # HG changeset patch
26 # Parent 04a6a82b8e06669a42181c96381b4fbc3ffa008c
27 Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
30 diff -r 04a6a82b8e06 -r 193f80e01b02 libstdc++-v3/configure.host
31 --- a/libstdc++-v3/configure.host Wed Nov 21 21:16:58 2012 -0500
32 +++ b/libstdc++-v3/configure.host Wed Nov 21 21:17:38 2012 -0500
33 @@ -243,6 +243,13 @@
34 os_include_dir="os/bsd/freebsd"
36 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
37 + # check for musl by target
38 + case "${host_os}" in
39 + *-musl*)
40 + os_include_dir="os/generic"
41 + ;;
42 + *)
44 if [ "$uclibc" = "yes" ]; then
45 os_include_dir="os/uclibc"
46 elif [ "$bionic" = "yes" ]; then
47 @@ -251,6 +258,9 @@
48 os_include_dir="os/gnu-linux"
52 + esac
53 + ;;
54 hpux*)
55 os_include_dir="os/hpux"
57 # HG changeset patch
58 # Parent 2e7d957327be4f40b062a755bb2853c9a2667493
59 Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker.
61 diff -r 2e7d957327be gcc/config.gcc
62 --- a/gcc/config.gcc Sun Jul 28 12:31:27 2013 -0400
63 +++ b/gcc/config.gcc Sun Jul 28 12:32:50 2013 -0400
64 @@ -478,7 +478,7 @@
65 esac
67 # Common C libraries.
68 -tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
69 +tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
71 # Common parts for widely ported systems.
72 case ${target} in
73 @@ -591,6 +591,9 @@
74 *-*-*uclibc*)
75 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
77 + *-*-*musl*)
78 + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
79 + ;;
81 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
83 diff -r 2e7d957327be gcc/config/linux.h
84 --- a/gcc/config/linux.h Sun Jul 28 12:31:27 2013 -0400
85 +++ b/gcc/config/linux.h Sun Jul 28 12:32:50 2013 -0400
86 @@ -33,10 +33,12 @@
87 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
88 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
89 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
90 +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
91 #else
92 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
93 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
94 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
95 +#define OPTION_MUSL (linux_libc == LIBC_MUSL)
96 #endif
98 #define LINUX_TARGET_OS_CPP_BUILTINS() \
99 @@ -54,18 +56,21 @@
100 uClibc or Bionic is the default C library and whether
101 -muclibc or -mglibc or -mbionic has been passed to change the default. */
103 -#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
104 - "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
105 +#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
106 + "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
108 #if DEFAULT_LIBC == LIBC_GLIBC
109 -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
110 - CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
111 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
112 + CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
113 #elif DEFAULT_LIBC == LIBC_UCLIBC
114 -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
115 - CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
116 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
117 + CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
118 #elif DEFAULT_LIBC == LIBC_BIONIC
119 -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
120 - CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
121 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
122 + CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
123 +#elif DEFAULT_LIBC == LIBC_MUSL
124 +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
125 + CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
126 #else
127 #error "Unsupported DEFAULT_LIBC"
128 #endif /* DEFAULT_LIBC */
129 @@ -83,13 +88,13 @@
131 #define LINUX_DYNAMIC_LINKER \
132 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
133 - BIONIC_DYNAMIC_LINKER)
134 + BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
135 #define LINUX_DYNAMIC_LINKER32 \
136 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
137 - BIONIC_DYNAMIC_LINKER32)
138 + BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
139 #define LINUX_DYNAMIC_LINKER64 \
140 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
141 - BIONIC_DYNAMIC_LINKER64)
142 + BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
144 /* Determine whether the entire c99 runtime
145 is present in the runtime library. */
146 diff -r 2e7d957327be gcc/config/linux.opt
147 --- a/gcc/config/linux.opt Sun Jul 28 12:31:27 2013 -0400
148 +++ b/gcc/config/linux.opt Sun Jul 28 12:32:50 2013 -0400
149 @@ -30,3 +30,7 @@
150 muclibc
151 Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
152 Use uClibc C library
154 +mmusl
155 +Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
156 +Use musl C library
157 diff -r 2e7d957327be gcc/ginclude/stddef.h
158 --- a/gcc/ginclude/stddef.h Sun Jul 28 12:31:27 2013 -0400
159 +++ b/gcc/ginclude/stddef.h Sun Jul 28 12:32:50 2013 -0400
160 @@ -184,6 +184,7 @@
161 #ifndef _GCC_SIZE_T
162 #ifndef _SIZET_
163 #ifndef __size_t
164 +#ifndef __DEFINED_size_t /* musl */
165 #define __size_t__ /* BeOS */
166 #define __SIZE_T__ /* Cray Unicos/Mk */
167 #define _SIZE_T
168 @@ -200,6 +201,7 @@
169 #define ___int_size_t_h
170 #define _GCC_SIZE_T
171 #define _SIZET_
172 +#define __DEFINED_size_t /* musl */
173 #if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
174 /* __size_t is a typedef on FreeBSD 5!, must not trash it. */
175 #else
176 @@ -214,6 +216,7 @@
177 typedef long ssize_t;
178 #endif /* __BEOS__ */
179 #endif /* !(defined (__GNUG__) && defined (size_t)) */
180 +#endif /* __DEFINED_size_t */
181 #endif /* __size_t */
182 #endif /* _SIZET_ */
183 #endif /* _GCC_SIZE_T */
184 # HG changeset patch
185 # Parent 45cd88d4fb7b0e813578c296004eaab2c2d0bfb9
186 A fix for libgomp to correctly request a POSIX version for time support.
189 diff -r 45cd88d4fb7b -r 0afd9d82498d libgomp/config/posix/time.c
190 --- a/libgomp/config/posix/time.c Wed Nov 21 21:19:19 2012 -0500
191 +++ b/libgomp/config/posix/time.c Wed Nov 21 21:20:22 2012 -0500
192 @@ -28,6 +28,8 @@
193 The following implementation uses the most simple POSIX routines.
194 If present, POSIX 4 clocks should be used instead. */
196 +#define _POSIX_C_SOURCE 199309L /* for clocks */
198 #include "libgomp.h"
199 #include <unistd.h>
200 #if TIME_WITH_SYS_TIME
201 --- a/gcc/configure
202 +++ b/gcc/configure
203 @@ -26970,6 +26970,9 @@
204 gcc_cv_target_dl_iterate_phdr=no
207 + *-linux-musl*)
208 + gcc_cv_target_dl_iterate_phdr=yes
209 + ;;
210 esac
212 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
214 # HG changeset patch
215 # Parent 94e435662aff38e86c9ca0dff4bbf451e0190b34
216 Get rid of ever-broken fixincludes on musl.
219 diff -r 94e435662aff -r e27957848dc8 fixincludes/mkfixinc.sh
220 --- a/fixincludes/mkfixinc.sh Sat Jul 27 23:37:20 2013 -0400
221 +++ b/fixincludes/mkfixinc.sh Sat Jul 27 23:43:03 2013 -0400
222 @@ -19,7 +19,8 @@
223 powerpc-*-eabi* | \
224 powerpc-*-rtems* | \
225 powerpcle-*-eabisim* | \
226 - powerpcle-*-eabi* )
227 + powerpcle-*-eabi* | \
228 + *-musl* )
229 # IF there is no include fixing,
230 # THEN create a no-op fixer and exit
231 (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
232 # HG changeset patch
233 # Parent 10fd4ac52b9577b778175e7836212acda12f20d5
234 Support for i386-linux-musl and x86_64-linux-musl.
236 diff -r 10fd4ac52b95 gcc/config/i386/linux.h
237 --- a/gcc/config/i386/linux.h Sun Jul 28 12:33:22 2013 -0400
238 +++ b/gcc/config/i386/linux.h Sun Jul 28 12:34:21 2013 -0400
239 @@ -93,6 +93,7 @@
240 /* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
241 #define LINK_EMULATION "elf_i386"
242 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
243 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
245 #undef ASM_SPEC
246 #define ASM_SPEC \
247 diff -r 10fd4ac52b95 gcc/config/i386/linux64.h
248 --- a/gcc/config/i386/linux64.h Sun Jul 28 12:33:22 2013 -0400
249 +++ b/gcc/config/i386/linux64.h Sun Jul 28 12:34:21 2013 -0400
250 @@ -65,6 +65,9 @@
251 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
252 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
254 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
255 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
257 #if TARGET_64BIT_DEFAULT
258 #define SPEC_32 "m32"
259 #define SPEC_64 "!m32"
260 # HG changeset patch
261 # Parent 38622d62109549821658a516f9bfff87b07c6dd1
262 Support for arm-linux-musl.
264 diff -r 38622d621095 gcc/config/arm/linux-eabi.h
265 --- a/gcc/config/arm/linux-eabi.h Sun Jul 28 12:34:21 2013 -0400
266 +++ b/gcc/config/arm/linux-eabi.h Sun Jul 28 12:34:47 2013 -0400
267 @@ -64,6 +64,10 @@
268 #undef GLIBC_DYNAMIC_LINKER
269 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
271 +/* musl has no "classic" (i.e. broken) mode */
272 +#undef MUSL_DYNAMIC_LINKER
273 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
275 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
276 use the GNU/Linux version, not the generic BPABI version. */
277 #undef LINK_SPEC
278 # HG changeset patch
279 # Parent 0a4e297edad6e46f4b66401b93b217aa3194af4e
280 Support for mips-linux-musl.
283 diff -r 0a4e297edad6 -r 78025c74c5c1 gcc/config/mips/linux.h
284 --- a/gcc/config/mips/linux.h Wed Nov 21 21:21:54 2012 -0500
285 +++ b/gcc/config/mips/linux.h Wed Nov 21 21:23:49 2012 -0500
286 @@ -63,6 +63,8 @@
288 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
290 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
292 /* Borrowed from sparc/linux.h */
293 #undef LINK_SPEC
294 #define LINK_SPEC \
295 diff -r 73dc8eee5c52 gcc/config.gcc
296 --- a/gcc/config.gcc Sun Jul 28 12:34:51 2013 -0400
297 +++ b/gcc/config.gcc Sun Jul 28 12:39:11 2013 -0400
298 @@ -2191,6 +2191,10 @@
299 powerpc*-*-linux*paired*)
300 tm_file="${tm_file} rs6000/750cl.h" ;;
301 esac
302 + case ${target} in
303 + *-linux*-musl*)
304 + enable_secureplt=yes ;;
305 + esac
306 if test x${enable_secureplt} = xyes; then
307 tm_file="rs6000/secureplt.h ${tm_file}"
309 diff -r 73dc8eee5c52 gcc/config/rs6000/linux64.h
310 --- a/gcc/config/rs6000/linux64.h Sun Jul 28 12:34:51 2013 -0400
311 +++ b/gcc/config/rs6000/linux64.h Sun Jul 28 12:39:11 2013 -0400
312 @@ -376,17 +376,21 @@
313 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
314 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
315 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
316 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
317 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
318 #if DEFAULT_LIBC == LIBC_UCLIBC
319 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
320 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
321 #elif DEFAULT_LIBC == LIBC_GLIBC
322 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
323 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
324 +#elif DEFAULT_LIBC == LIBC_MUSL
325 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
326 #else
327 #error "Unsupported DEFAULT_LIBC"
328 #endif
329 #define LINUX_DYNAMIC_LINKER32 \
330 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
331 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
332 #define LINUX_DYNAMIC_LINKER64 \
333 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
334 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
337 #define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
338 diff -r 73dc8eee5c52 gcc/config/rs6000/secureplt.h
339 --- a/gcc/config/rs6000/secureplt.h Sun Jul 28 12:34:51 2013 -0400
340 +++ b/gcc/config/rs6000/secureplt.h Sun Jul 28 12:39:11 2013 -0400
341 @@ -18,3 +18,4 @@
342 <http://www.gnu.org/licenses/>. */
344 #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
345 +#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
346 diff -r 73dc8eee5c52 gcc/config/rs6000/sysv4.h
347 --- a/gcc/config/rs6000/sysv4.h Sun Jul 28 12:34:51 2013 -0400
348 +++ b/gcc/config/rs6000/sysv4.h Sun Jul 28 12:39:11 2013 -0400
349 @@ -574,6 +574,9 @@
350 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
351 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
352 #endif
353 +#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
354 +#define LINK_SECURE_PLT_DEFAULT_SPEC ""
355 +#endif
357 /* Pass -G xxx to the compiler and set correct endian mode. */
358 #define CC1_SPEC "%{G*} %(cc1_cpu) \
359 @@ -637,7 +640,8 @@
360 %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
361 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
362 %{mcall-i960-old: --oformat elf32-powerpcle} \
363 - }}}}"
364 + }}}} \
365 +%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
367 /* Any specific OS flags. */
368 #define LINK_OS_SPEC "\
369 @@ -820,15 +824,18 @@
371 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
372 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
373 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
374 #if DEFAULT_LIBC == LIBC_UCLIBC
375 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
376 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
377 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
378 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
379 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
380 +#elif DEFAULT_LIBC == LIBC_MUSL
381 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
382 #else
383 #error "Unsupported DEFAULT_LIBC"
384 #endif
385 #define LINUX_DYNAMIC_LINKER \
386 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
387 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
389 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
390 %{rdynamic:-export-dynamic} \
391 @@ -984,6 +991,7 @@
392 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
393 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
394 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
395 + { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
396 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
397 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
398 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \