add psp-gcc 13.2.0 patch
[rofl0r-mmix-cross.git] / patches / gcc-4.0.3-musl.diff
blob53bfe9ab20411a11ee75be7b7d5ae4065add5b2e
1 diff -r d6f84a2db6ba config.sub
2 --- a/config.sub Mon Mar 11 17:14:07 2013 -0400
3 +++ b/config.sub Mon Mar 11 18:34:53 2013 -0400
4 @@ -119,7 +119,7 @@
5 # Here we must recognize all the valid KERNEL-OS combinations.
6 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
7 case $maybe_os in
8 - nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
9 + nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | linux-musl* | uclinux-uclibc* | uclinux-gnu* | \
10 kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
11 os=-$maybe_os
12 basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
13 @@ -1189,7 +1189,7 @@
14 | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
15 | -chorusos* | -chorusrdb* \
16 | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
17 - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
18 + | -mingw32* | -linux-gnu* | -linux-uclibc* | -linux-musl* | -uxpv* | -beos* | -mpeix* | -udk* \
19 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
20 | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
21 | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
22 diff -r d6f84a2db6ba gcc/config.gcc
23 --- a/gcc/config.gcc Mon Mar 11 17:14:07 2013 -0400
24 +++ b/gcc/config.gcc Mon Mar 11 18:34:53 2013 -0400
25 @@ -452,6 +452,14 @@
26 "" | yes | posix) thread_file='posix' ;;
27 esac
28 tmake_file="t-slibgcc-elf-ver t-linux"
29 + case ${target} in
30 + *-*-*musl*)
31 + tm_defines="${tm_defines} MUSL_LIBC=1"
32 + ;;
33 + *)
34 + tm_defines="${tm_defines} MUSL_LIBC=0"
35 + ;;
36 + esac
38 *-*-gnu*)
39 # On the Hurd, the setup is just about the same on
40 diff -r d6f84a2db6ba gcc/config/i386/linux.h
41 --- a/gcc/config/i386/linux.h Mon Mar 11 17:14:07 2013 -0400
42 +++ b/gcc/config/i386/linux.h Mon Mar 11 18:34:53 2013 -0400
43 @@ -105,7 +105,11 @@
44 /* If ELF is the default format, we should not use /lib/elf. */
46 #define LINK_EMULATION "elf_i386"
47 +#if !MUSL_LIBC
48 #define DYNAMIC_LINKER "/lib/ld-linux.so.2"
49 +#else
50 +#define DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
51 +#endif
53 #undef SUBTARGET_EXTRA_SPECS
54 #define SUBTARGET_EXTRA_SPECS \
55 diff -r d6f84a2db6ba gcc/config/i386/linux64.h
56 --- a/gcc/config/i386/linux64.h Mon Mar 11 17:14:07 2013 -0400
57 +++ b/gcc/config/i386/linux64.h Mon Mar 11 18:34:53 2013 -0400
58 @@ -55,6 +55,7 @@
59 done. */
61 #undef LINK_SPEC
62 +#if !MUSL_LIBC
63 #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
64 %{shared:-shared} \
65 %{!shared: \
66 @@ -63,6 +64,16 @@
67 %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
68 %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \
69 %{static:-static}}"
70 +#else
71 +#define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
72 + %{shared:-shared} \
73 + %{!shared: \
74 + %{!static: \
75 + %{rdynamic:-export-dynamic} \
76 + %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-musl-i386.so.1}} \
77 + %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-musl-x86_64.so.1}}} \
78 + %{static:-static}}"
79 +#endif
81 #define MULTILIB_DEFAULTS { "m64" }
83 diff -r d6f84a2db6ba gcc/config/mips/linux.h
84 --- a/gcc/config/mips/linux.h Mon Mar 11 17:14:07 2013 -0400
85 +++ b/gcc/config/mips/linux.h Mon Mar 11 18:34:53 2013 -0400
86 @@ -106,6 +106,8 @@
87 #undef MIPS_DEFAULT_GVALUE
88 #define MIPS_DEFAULT_GVALUE 0
90 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
92 /* Borrowed from sparc/linux.h */
93 #undef LINK_SPEC
94 #define LINK_SPEC \
95 diff -r d6f84a2db6ba gcc/ginclude/stddef.h
96 --- a/gcc/ginclude/stddef.h Mon Mar 11 17:14:07 2013 -0400
97 +++ b/gcc/ginclude/stddef.h Mon Mar 11 18:34:53 2013 -0400
98 @@ -186,6 +186,7 @@
99 #ifndef _GCC_SIZE_T
100 #ifndef _SIZET_
101 #ifndef __size_t
102 +#ifndef __DEFINED_size_t /* musl */
103 #define __size_t__ /* BeOS */
104 #define __SIZE_T__ /* Cray Unicos/Mk */
105 #define _SIZE_T
106 @@ -202,6 +203,7 @@
107 #define ___int_size_t_h
108 #define _GCC_SIZE_T
109 #define _SIZET_
110 +#define __DEFINED_size_t /* musl */
111 #if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
112 /* __size_t is a typedef on FreeBSD 5!, must not trash it. */
113 #else
114 @@ -216,6 +218,7 @@
115 typedef long ssize_t;
116 #endif /* __BEOS__ */
117 #endif /* !(defined (__GNUG__) && defined (size_t)) */
118 +#endif /* __DEFINED_size_t */
119 #endif /* __size_t */
120 #endif /* _SIZET_ */
121 #endif /* _GCC_SIZE_T */
122 diff -r d6f84a2db6ba libstdc++-v3/configure
123 --- a/libstdc++-v3/configure Mon Mar 11 17:14:07 2013 -0400
124 +++ b/libstdc++-v3/configure Mon Mar 11 18:34:53 2013 -0400
125 @@ -84175,6 +84175,8 @@
126 #define HAVE_FABSF 1
127 _ACEOF
129 +case "${host}" in
130 + *-linux-gnu*)
131 cat >>confdefs.h <<\_ACEOF
132 #define HAVE_FINITE 1
133 _ACEOF
134 @@ -84182,6 +84184,8 @@
135 cat >>confdefs.h <<\_ACEOF
136 #define HAVE_FINITEF 1
137 _ACEOF
138 + ;;
139 +esac
141 cat >>confdefs.h <<\_ACEOF
142 #define HAVE_FLOORF 1
143 diff -r d6f84a2db6ba libstdc++-v3/configure.host
144 --- a/libstdc++-v3/configure.host Mon Mar 11 17:14:07 2013 -0400
145 +++ b/libstdc++-v3/configure.host Mon Mar 11 18:34:53 2013 -0400
146 @@ -194,8 +194,18 @@
147 os_include_dir="os/bsd/freebsd"
149 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
150 + # check for musl by target
151 + case "${host_os}" in
152 + *-musl*)
153 + os_include_dir="os/generic"
154 + ;;
155 + *)
157 os_include_dir="os/gnu-linux"
160 + esac
161 + ;;
162 hpux*)
163 os_include_dir="os/hpux"