9436c7d1ce09ffff786f4a531d71a1699c860eb2
[openwrt/svn-archive/archive.git] / openwrt / toolchain / gcc / 4.0.1 / 100-uclibc-conf.patch
1 diff -urN gcc-4.1.0/boehm-gc/configure gcc-4.1.0-patched/boehm-gc/configure
2 --- gcc-4.1.0/boehm-gc/configure 2005-04-13 19:31:24.000000000 -0500
3 +++ gcc-4.1.0-patched/boehm-gc/configure 2005-04-25 20:47:19.919723167 -0500
4 @@ -4320,6 +4320,11 @@
5 lt_cv_deplibs_check_method=pass_all
6 ;;
7
8 +linux-uclibc*)
9 + lt_cv_deplibs_check_method=pass_all
10 + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
11 + ;;
12 +
13 netbsd* | knetbsd*-gnu)
14 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
15 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
16 diff -urN gcc-4.1.0/gcc/config/arm/linux-elf.h gcc-4.1.0-patched/gcc/config/arm/linux-elf.h
17 --- gcc-4.1.0/gcc/config/arm/linux-elf.h 2005-03-02 10:27:42.000000000 -0600
18 +++ gcc-4.1.0-patched/gcc/config/arm/linux-elf.h 2005-04-25 20:45:31.795953620 -0500
19 @@ -82,6 +82,18 @@
20 "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
21
22 #undef LINK_SPEC
23 +#ifdef USE_UCLIBC
24 +#define LINK_SPEC "%{h*} %{version:-v} \
25 + %{b} %{Wl,*:%*} \
26 + %{static:-Bstatic} \
27 + %{shared:-shared} \
28 + %{symbolic:-Bsymbolic} \
29 + %{rdynamic:-export-dynamic} \
30 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} \
31 + -X \
32 + %{mbig-endian:-EB}" \
33 + SUBTARGET_EXTRA_LINK_SPEC
34 +#else
35 #define LINK_SPEC "%{h*} %{version:-v} \
36 %{b} %{Wl,*:%*} \
37 %{static:-Bstatic} \
38 @@ -92,6 +104,7 @@
39 -X \
40 %{mbig-endian:-EB}" \
41 SUBTARGET_EXTRA_LINK_SPEC
42 +#endif
43
44 #define TARGET_OS_CPP_BUILTINS() \
45 do \
46 diff -urN gcc-4.1.0/gcc/config/cris/linux.h gcc-4.1.0-patched/gcc/config/cris/linux.h
47 --- gcc-4.1.0/gcc/config/cris/linux.h 2005-04-23 23:01:27.000000000 -0500
48 +++ gcc-4.1.0-patched/gcc/config/cris/linux.h 2005-04-25 20:45:31.796953451 -0500
49 @@ -73,6 +73,25 @@
50 #undef CRIS_DEFAULT_CPU_VERSION
51 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
52
53 +#ifdef USE_UCLIBC
54 +
55 +#undef CRIS_SUBTARGET_VERSION
56 +#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
57 +
58 +#undef CRIS_LINK_SUBTARGET_SPEC
59 +#define CRIS_LINK_SUBTARGET_SPEC \
60 + "-mcrislinux\
61 + -rpath-link include/asm/../..%s\
62 + %{shared} %{static}\
63 + %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\
64 + %{!shared: \
65 + %{!static: \
66 + %{rdynamic:-export-dynamic} \
67 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \
68 + %{!r:%{O2|O3: --gc-sections}}"
69 +
70 +#else /* USE_UCLIBC */
71 +
72 #undef CRIS_SUBTARGET_VERSION
73 #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
74
75 @@ -87,6 +106,8 @@
76 %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\
77 %{!r:%{O2|O3: --gc-sections}}"
78
79 +#endif /* USE_UCLIBC */
80 +
81
82 /* Node: Run-time Target */
83
84 diff -urN gcc-4.1.0/gcc/config/cris/t-linux-uclibc gcc-4.1.0-patched/gcc/config/cris/t-linux-uclibc
85 --- gcc-4.1.0/gcc/config/cris/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
86 +++ gcc-4.1.0-patched/gcc/config/cris/t-linux-uclibc 2005-04-25 20:45:31.797953283 -0500
87 @@ -0,0 +1,3 @@
88 +T_CFLAGS = -DUSE_UCLIBC
89 +TARGET_LIBGCC2_CFLAGS += -fPIC
90 +CRTSTUFF_T_CFLAGS_S = $(TARGET_LIBGCC2_CFLAGS)
91 diff -urN gcc-4.1.0/gcc/config/i386/linux.h gcc-4.1.0-patched/gcc/config/i386/linux.h
92 --- gcc-4.1.0/gcc/config/i386/linux.h 2004-11-27 10:45:14.000000000 -0600
93 +++ gcc-4.1.0-patched/gcc/config/i386/linux.h 2005-04-25 21:21:05.828409973 -0500
94 @@ -104,8 +104,13 @@
95
96 /* If ELF is the default format, we should not use /lib/elf. */
97
98 +#if defined USE_UCLIBC
99 +#define LINK_EMULATION "elf_i386"
100 +#define DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
101 +#else
102 #define LINK_EMULATION "elf_i386"
103 #define DYNAMIC_LINKER "/lib/ld-linux.so.2"
104 +#endif
105
106 #undef SUBTARGET_EXTRA_SPECS
107 #define SUBTARGET_EXTRA_SPECS \
108 @@ -144,6 +149,7 @@
109 } \
110 } while (0)
111 #endif
112 +#endif
113
114 /* Handle special EH pointer encodings. Absolute, pc-relative, and
115 indirect are handled automatically. */
116 diff -urN gcc-4.1.0/gcc/config/mips/linux.h gcc-4.1.0-patched/gcc/config/mips/linux.h
117 --- gcc-4.1.0/gcc/config/mips/linux.h 2005-01-25 20:04:46.000000000 -0600
118 +++ gcc-4.1.0-patched/gcc/config/mips/linux.h 2005-04-25 20:45:31.809951259 -0500
119 @@ -108,6 +108,17 @@
120
121 /* Borrowed from sparc/linux.h */
122 #undef LINK_SPEC
123 +#ifdef USE_UCLIBC
124 +#define LINK_SPEC \
125 + "%(endian_spec) \
126 + %{shared:-shared} \
127 + %{!shared: \
128 + %{!ibcs: \
129 + %{!static: \
130 + %{rdynamic:-export-dynamic} \
131 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
132 + %{static:-static}}}"
133 +#else
134 #define LINK_SPEC \
135 "%(endian_spec) \
136 %{shared:-shared} \
137 @@ -117,6 +128,7 @@
138 %{rdynamic:-export-dynamic} \
139 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
140 %{static:-static}}}"
141 +#endif
142
143 #undef SUBTARGET_ASM_SPEC
144 #define SUBTARGET_ASM_SPEC "%{mabi=64: -64} %{!mno-abicalls:-KPIC}"
145 diff -urN gcc-4.1.0/gcc/config/rs6000/linux.h gcc-4.1.0-patched/gcc/config/rs6000/linux.h
146 --- gcc-4.1.0/gcc/config/rs6000/linux.h 2004-12-01 20:21:28.000000000 -0600
147 +++ gcc-4.1.0-patched/gcc/config/rs6000/linux.h 2005-04-25 20:45:31.810951091 -0500
148 @@ -69,7 +69,11 @@
149 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
150
151 #undef LINK_OS_DEFAULT_SPEC
152 +#ifdef USE_UCLIBC
153 +#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)"
154 +#else
155 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
156 +#endif
157
158 #define LINK_GCC_C_SEQUENCE_SPEC \
159 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
160 diff -urN gcc-4.1.0/gcc/config/rs6000/sysv4.h gcc-4.1.0-patched/gcc/config/rs6000/sysv4.h
161 --- gcc-4.1.0/gcc/config/rs6000/sysv4.h 2005-04-13 19:26:50.000000000 -0500
162 +++ gcc-4.1.0-patched/gcc/config/rs6000/sysv4.h 2005-04-25 20:45:31.812950754 -0500
163 @@ -957,6 +957,7 @@
164 mcall-linux : %(link_os_linux) ; \
165 mcall-gnu : %(link_os_gnu) ; \
166 mcall-netbsd : %(link_os_netbsd) ; \
167 + mcall-linux-uclibc : %(link_os_linux_uclibc); \
168 mcall-openbsd: %(link_os_openbsd) ; \
169 : %(link_os_default) }"
170
171 @@ -1135,6 +1136,10 @@
172 %{rdynamic:-export-dynamic} \
173 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
174
175 +#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \
176 + %{rdynamic:-export-dynamic} \
177 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}"
178 +
179 #if defined(HAVE_LD_EH_FRAME_HDR)
180 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
181 #endif
182 @@ -1301,6 +1306,7 @@
183 { "link_os_sim", LINK_OS_SIM_SPEC }, \
184 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
185 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
186 + { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \
187 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
188 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
189 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
190 diff -urN gcc-4.1.0/gcc/config/sh/linux.h gcc-4.1.0-patched/gcc/config/sh/linux.h
191 --- gcc-4.1.0/gcc/config/sh/linux.h 2005-02-28 21:39:03.000000000 -0600
192 +++ gcc-4.1.0-patched/gcc/config/sh/linux.h 2005-04-25 20:45:31.814950416 -0500
193 @@ -55,12 +55,21 @@
194 #undef SUBTARGET_LINK_EMUL_SUFFIX
195 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
196 #undef SUBTARGET_LINK_SPEC
197 +#ifdef USE_UCLIBC
198 +#define SUBTARGET_LINK_SPEC \
199 + "%{shared:-shared} \
200 + %{!static: \
201 + %{rdynamic:-export-dynamic} \
202 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
203 + %{static:-static}"
204 +#else
205 #define SUBTARGET_LINK_SPEC \
206 "%{shared:-shared} \
207 %{!static: \
208 %{rdynamic:-export-dynamic} \
209 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
210 %{static:-static}"
211 +#endif
212
213 /* Output assembler code to STREAM to call the profiler. */
214
215 diff -urN gcc-4.1.0/gcc/config/sh/t-linux-uclibc gcc-4.1.0-patched/gcc/config/sh/t-linux-uclibc
216 --- gcc-4.1.0/gcc/config/sh/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
217 +++ gcc-4.1.0-patched/gcc/config/sh/t-linux-uclibc 2005-04-25 20:45:31.814950416 -0500
218 @@ -0,0 +1,13 @@
219 +T_CFLAGS = -DUSE_UCLIBC
220 +
221 +TARGET_LIBGCC2_CFLAGS = -fpic -DNO_FPSCR_VALUES
222 +LIB1ASMFUNCS_CACHE = _ic_invalidate
223 +
224 +LIB2FUNCS_EXTRA=
225 +
226 +MULTILIB_OPTIONS= $(MULTILIB_ENDIAN) m3e/m4
227 +MULTILIB_DIRNAMES=
228 +MULTILIB_MATCHES =
229 +MULTILIB_EXCEPTIONS=
230 +
231 +EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
232 diff -urN gcc-4.1.0/gcc/config/sh/t-sh64-uclibc gcc-4.1.0-patched/gcc/config/sh/t-sh64-uclibc
233 --- gcc-4.1.0/gcc/config/sh/t-sh64-uclibc 1969-12-31 18:00:00.000000000 -0600
234 +++ gcc-4.1.0-patched/gcc/config/sh/t-sh64-uclibc 2005-04-25 20:45:31.815950248 -0500
235 @@ -0,0 +1,13 @@
236 +EXTRA_MULTILIB_PARTS= crt1.o crti.o crtn.o crtbegin.o crtend.o
237 +
238 +LIB1ASMFUNCS = \
239 + _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \
240 + _shcompact_call_trampoline _shcompact_return_trampoline \
241 + _shcompact_incoming_args _ic_invalidate _nested_trampoline \
242 + _push_pop_shmedia_regs \
243 + _udivdi3 _divdi3 _umoddi3 _moddi3
244 +
245 +MULTILIB_OPTIONS = $(MULTILIB_ENDIAN) m5-32media-nofpu/m5-compact/m5-compact-nofpu/m5-64media/m5-64media-nofpu
246 +MULTILIB_DIRNAMES= $(MULTILIB_ENDIAN) nofpu compact nofpu/compact media64 nofpu/media64
247 +MULTILIB_MATCHES=
248 +MULTILIB_EXCEPTIONS=
249 diff -urN gcc-4.1.0/gcc/config/t-linux-uclibc gcc-4.1.0-patched/gcc/config/t-linux-uclibc
250 --- gcc-4.1.0/gcc/config/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
251 +++ gcc-4.1.0-patched/gcc/config/t-linux-uclibc 2005-04-25 20:45:31.815950248 -0500
252 @@ -0,0 +1,15 @@
253 +T_CFLAGS = -DUSE_UCLIBC
254 +
255 +# Compile crtbeginS.o and crtendS.o with pic.
256 +CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
257 +# Compile libgcc2.a with pic.
258 +TARGET_LIBGCC2_CFLAGS = -fPIC
259 +
260 +# Override t-slibgcc-elf-ver to export some libgcc symbols with
261 +# the symbol versions that glibc used.
262 +#SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
263 +
264 +# Use unwind-dw2-fde
265 +LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
266 + $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c
267 +LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h
268 diff -urN gcc-4.1.0/gcc/config.gcc gcc-4.1.0-patched/gcc/config.gcc
269 --- gcc-4.1.0/gcc/config.gcc 2005-04-23 23:01:23.000000000 -0500
270 +++ gcc-4.1.0-patched/gcc/config.gcc 2005-04-25 21:12:43.375594576 -0500
271 @@ -448,7 +448,14 @@
272 case ${enable_threads} in
273 "" | yes | posix) thread_file='posix' ;;
274 esac
275 - tmake_file="t-slibgcc-elf-ver t-linux"
276 + case ${target} in
277 + *-linux*uclibc*)
278 + tmake_file="t-slibgcc-elf-ver t-linux-uclibc"
279 + ;;
280 + *)
281 + tmake_file="t-slibgcc-elf-ver t-linux"
282 + ;;
283 + esac
284 ;;
285 *-*-gnu*)
286 # On the Hurd, the setup is just about the same on
287 @@ -667,6 +674,12 @@
288 extra_parts=""
289 use_collect2=yes
290 ;;
291 +arm*-*-linux-uclibc*) # ARM GNU/Linux with ELF - uClibc
292 + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
293 + tmake_file="t-slibgcc-elf-ver t-linux-uclibc arm/t-linux"
294 + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
295 + gnu_ld=yes
296 + ;;
297 arm*-*-linux*) # ARM GNU/Linux with ELF
298 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
299 tmake_file="${tmake_file} arm/t-arm arm/t-linux"
300 @@ -765,6 +778,10 @@
301 gas=yes
302 extra_options="${extra_options} cris/elf.opt"
303 ;;
304 +cris-*-linux-uclibc*)
305 + tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h"
306 + tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux-uclibc"
307 + ;;
308 cris-*-linux*)
309 tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h"
310 # We need to avoid using t-linux, so override default tmake_file
311 @@ -1443,6 +1460,16 @@
312 gnu_ld=yes
313 gas=yes
314 ;;
315 +mips*-*-linux-uclibc*) # Linux MIPS, either endian. uClibc
316 + tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
317 + case ${target} in
318 + mipsisa32*-*)
319 + target_cpu_default="MASK_SOFT_FLOAT"
320 + tm_defines="MIPS_ISA_DEFAULT=32"
321 + ;;
322 + esac
323 + tmake_file="t-slibgcc-elf-ver t-linux-uclibc"
324 + ;;
325 mips*-*-linux*) # Linux MIPS, either endian.
326 tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
327 case ${target} in
328 @@ -1659,6 +1686,10 @@
329 tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxspe.h"
330 tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
331 ;;
332 +powerpc-*-linux-uclibc*)
333 + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h"
334 + tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-linux-uclibc rs6000/t-ppccomm"
335 + ;;
336 powerpc-*-linux*)
337 tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h"
338 tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
339 @@ -1821,6 +1852,8 @@
340 esac
341 tm_file="${tm_file} sh/elf.h"
342 case ${target} in
343 + sh*-*-linux-uclibc*) tmake_file="${tmake_file} t-linux-uclibc sh/t-linux-uclibc"
344 + tm_file="${tm_file} linux.h sh/linux.h" ;;
345 sh*-*-linux*) tmake_file="${tmake_file} sh/t-linux"
346 tm_file="${tm_file} linux.h sh/linux.h" ;;
347 sh*-*-kaos*) tm_file="${tm_file} sh/embed-elf.h kaos.h sh/kaos-sh.h"
348 @@ -1840,6 +1873,11 @@
349 *-*-netbsd)
350 tmake_file="${tmake_file} sh/t-netbsd"
351 ;;
352 + sh64*-*-linux-uclibc*)
353 + tmake_file="${tmake_file} sh/t-sh64-uclibc"
354 + tm_file="${tm_file} sh/sh64.h"
355 + extra_headers="shmedia.h ushmedia.h sshmedia.h"
356 + ;;
357 sh64*-*-linux*)
358 tmake_file="${tmake_file} sh/t-sh64 sh/t-linux64"
359 tm_file="${tm_file} sh/sh64.h"
360 diff -urN gcc-4.1.0/libtool.m4 gcc-4.1.0-patched/libtool.m4
361 --- gcc-4.1.0/libtool.m4 2005-04-13 19:31:24.000000000 -0500
362 +++ gcc-4.1.0-patched/libtool.m4 2005-04-25 20:47:51.679369687 -0500
363 @@ -743,6 +743,11 @@
364 lt_cv_deplibs_check_method=pass_all
365 ;;
366
367 +linux-uclibc*)
368 + lt_cv_deplibs_check_method=pass_all
369 + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
370 + ;;
371 +
372 netbsd* | knetbsd*-gnu)
373 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
374 [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
375 diff -urN gcc-4.1.0/ltconfig gcc-4.1.0-patched/ltconfig
376 --- gcc-4.1.0/ltconfig 2004-10-02 11:33:06.000000000 -0500
377 +++ gcc-4.1.0-patched/ltconfig 2005-04-25 20:45:31.836946707 -0500
378 @@ -602,6 +602,7 @@
379
380 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
381 case $host_os in
382 +linux-uclibc*) ;;
383 linux-gnu*) ;;
384 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
385 esac
386 @@ -1273,6 +1274,24 @@
387 dynamic_linker='GNU/Linux ld.so'
388 ;;
389
390 +linux-uclibc*)
391 + version_type=linux
392 + need_lib_prefix=no
393 + need_version=no
394 + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
395 + soname_spec='${libname}${release}.so$major'
396 + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
397 + shlibpath_var=LD_LIBRARY_PATH
398 + shlibpath_overrides_runpath=no
399 + # This implies no fast_install, which is unacceptable.
400 + # Some rework will be needed to allow for fast_install
401 + # before this can be enabled.
402 + # Note: copied from linux-gnu, and may not be appropriate.
403 + hardcode_into_libs=yes
404 + # Assume using the uClibc dynamic linker.
405 + dynamic_linker="uClibc ld.so"
406 + ;;
407 +
408 netbsd*)
409 need_lib_prefix=no
410 need_version=no