[backfire] toolchain: fix gcc 3.4.6 (brcm-2.4) after relocation from usr/, refresh...
[openwrt/svn-archive/archive.git] / toolchain / gcc / patches / 3.4.6 / 100-uclibc-conf.patch
1 --- a/boehm-gc/configure
2 +++ b/boehm-gc/configure
3 @@ -1947,6 +1947,11 @@ linux-gnu*)
4 lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
5 ;;
6
7 +linux-uclibc*)
8 + lt_cv_deplibs_check_method=pass_all
9 + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
10 + ;;
11 +
12 netbsd*)
13 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
14 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
15 --- a/boehm-gc/ltconfig
16 +++ b/boehm-gc/ltconfig
17 @@ -1981,6 +1981,23 @@ linux-gnu*)
18 fi
19 ;;
20
21 +linux-uclibc*)
22 + version_type=linux
23 + need_lib_prefix=no
24 + need_version=no
25 + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
26 + soname_spec='${libname}${release}.so$major'
27 + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
28 + shlibpath_var=LD_LIBRARY_PATH
29 + shlibpath_overrides_runpath=no
30 + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
31 + file_magic_cmd=/usr/bin/file
32 + file_magic_test_file=`echo /lib/libuClibc-*.so`
33 +
34 + # Assume using the uClibc dynamic linker.
35 + dynamic_linker="uClibc ld.so"
36 + ;;
37 +
38 netbsd*)
39 version_type=sunos
40 if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
41 --- a/gcc/config/arm/linux-elf.h
42 +++ b/gcc/config/arm/linux-elf.h
43 @@ -81,6 +81,18 @@
44 "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
45
46 #undef LINK_SPEC
47 +#ifdef USE_UCLIBC
48 +#define LINK_SPEC "%{h*} %{version:-v} \
49 + %{b} %{Wl,*:%*} \
50 + %{static:-Bstatic} \
51 + %{shared:-shared} \
52 + %{symbolic:-Bsymbolic} \
53 + %{rdynamic:-export-dynamic} \
54 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} \
55 + -X \
56 + %{mbig-endian:-EB}" \
57 + SUBTARGET_EXTRA_LINK_SPEC
58 +#else
59 #define LINK_SPEC "%{h*} %{version:-v} \
60 %{b} %{Wl,*:%*} \
61 %{static:-Bstatic} \
62 @@ -91,6 +103,7 @@
63 -X \
64 %{mbig-endian:-EB}" \
65 SUBTARGET_EXTRA_LINK_SPEC
66 +#endif
67
68 #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
69
70 --- a/gcc/config/cris/linux.h
71 +++ b/gcc/config/cris/linux.h
72 @@ -79,6 +79,25 @@ Boston, MA 02111-1307, USA. */
73 #undef CRIS_DEFAULT_CPU_VERSION
74 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
75
76 +#ifdef USE_UCLIBC
77 +
78 +#undef CRIS_SUBTARGET_VERSION
79 +#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
80 +
81 +#undef CRIS_LINK_SUBTARGET_SPEC
82 +#define CRIS_LINK_SUBTARGET_SPEC \
83 + "-mcrislinux\
84 + -rpath-link include/asm/../..%s\
85 + %{shared} %{static}\
86 + %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\
87 + %{!shared: \
88 + %{!static: \
89 + %{rdynamic:-export-dynamic} \
90 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \
91 + %{!r:%{O2|O3: --gc-sections}}"
92 +
93 +#else /* USE_UCLIBC */
94 +
95 #undef CRIS_SUBTARGET_VERSION
96 #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
97
98 @@ -93,6 +112,8 @@ Boston, MA 02111-1307, USA. */
99 %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\
100 %{!r:%{O2|O3: --gc-sections}}"
101
102 +#endif /* USE_UCLIBC */
103 +
104
105 /* Node: Run-time Target */
106
107 --- /dev/null
108 +++ b/gcc/config/cris/t-linux-uclibc
109 @@ -0,0 +1,3 @@
110 +T_CFLAGS = -DUSE_UCLIBC
111 +TARGET_LIBGCC2_CFLAGS += -fPIC
112 +CRTSTUFF_T_CFLAGS_S = $(TARGET_LIBGCC2_CFLAGS)
113 --- a/gcc/config/i386/linux.h
114 +++ b/gcc/config/i386/linux.h
115 @@ -118,6 +118,15 @@ Boston, MA 02111-1307, USA. */
116 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
117 %{static:-static}}}"
118 #else
119 +#if defined USE_UCLIBC
120 +#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
121 + %{!shared: \
122 + %{!ibcs: \
123 + %{!static: \
124 + %{rdynamic:-export-dynamic} \
125 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
126 + %{static:-static}}}"
127 +#else
128 #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
129 %{!shared: \
130 %{!ibcs: \
131 @@ -126,6 +135,7 @@ Boston, MA 02111-1307, USA. */
132 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
133 %{static:-static}}}"
134 #endif
135 +#endif
136
137 /* A C statement (sans semicolon) to output to the stdio stream
138 FILE the assembler definition of uninitialized global DECL named
139 --- a/gcc/config/mips/linux.h
140 +++ b/gcc/config/mips/linux.h
141 @@ -109,6 +109,17 @@ Boston, MA 02111-1307, USA. */
142
143 /* Borrowed from sparc/linux.h */
144 #undef LINK_SPEC
145 +#ifdef USE_UCLIBC
146 +#define LINK_SPEC \
147 + "%(endian_spec) \
148 + %{shared:-shared} \
149 + %{!shared: \
150 + %{!ibcs: \
151 + %{!static: \
152 + %{rdynamic:-export-dynamic} \
153 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
154 + %{static:-static}}}"
155 +#else
156 #define LINK_SPEC \
157 "%(endian_spec) \
158 %{shared:-shared} \
159 @@ -118,6 +129,7 @@ Boston, MA 02111-1307, USA. */
160 %{rdynamic:-export-dynamic} \
161 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
162 %{static:-static}}}"
163 +#endif
164
165 #undef SUBTARGET_ASM_SPEC
166 #define SUBTARGET_ASM_SPEC "\
167 --- a/gcc/config/rs6000/linux.h
168 +++ b/gcc/config/rs6000/linux.h
169 @@ -69,7 +69,11 @@
170 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
171
172 #undef LINK_OS_DEFAULT_SPEC
173 +#ifdef USE_UCLIBC
174 +#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)"
175 +#else
176 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
177 +#endif
178
179 #define LINK_GCC_C_SEQUENCE_SPEC \
180 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
181 --- a/gcc/config/rs6000/sysv4.h
182 +++ b/gcc/config/rs6000/sysv4.h
183 @@ -949,6 +949,7 @@ extern int fixuplabelno;
184 mcall-linux : %(link_os_linux) ; \
185 mcall-gnu : %(link_os_gnu) ; \
186 mcall-netbsd : %(link_os_netbsd) ; \
187 + mcall-linux-uclibc : %(link_os_linux_uclibc); \
188 mcall-openbsd: %(link_os_openbsd) ; \
189 : %(link_os_default) }"
190
191 @@ -1127,6 +1128,10 @@ extern int fixuplabelno;
192 %{rdynamic:-export-dynamic} \
193 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
194
195 +#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \
196 + %{rdynamic:-export-dynamic} \
197 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}"
198 +
199 #if defined(HAVE_LD_EH_FRAME_HDR)
200 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
201 #endif
202 @@ -1293,6 +1298,7 @@ ncrtn.o%s"
203 { "link_os_sim", LINK_OS_SIM_SPEC }, \
204 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
205 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
206 + { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \
207 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
208 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
209 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
210 --- a/gcc/config/sh/linux.h
211 +++ b/gcc/config/sh/linux.h
212 @@ -73,12 +73,21 @@ do { \
213 #undef SUBTARGET_LINK_EMUL_SUFFIX
214 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
215 #undef SUBTARGET_LINK_SPEC
216 +#ifdef USE_UCLIBC
217 +#define SUBTARGET_LINK_SPEC \
218 + "%{shared:-shared} \
219 + %{!static: \
220 + %{rdynamic:-export-dynamic} \
221 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
222 + %{static:-static}"
223 +#else
224 #define SUBTARGET_LINK_SPEC \
225 "%{shared:-shared} \
226 %{!static: \
227 %{rdynamic:-export-dynamic} \
228 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
229 %{static:-static}"
230 +#endif
231
232 #undef LIB_SPEC
233 #define LIB_SPEC \
234 --- /dev/null
235 +++ b/gcc/config/sh/t-linux-uclibc
236 @@ -0,0 +1,13 @@
237 +T_CFLAGS = -DUSE_UCLIBC
238 +
239 +TARGET_LIBGCC2_CFLAGS = -fpic -DNO_FPSCR_VALUES
240 +LIB1ASMFUNCS_CACHE = _ic_invalidate
241 +
242 +LIB2FUNCS_EXTRA=
243 +
244 +MULTILIB_OPTIONS= $(MULTILIB_ENDIAN) m3e/m4
245 +MULTILIB_DIRNAMES=
246 +MULTILIB_MATCHES =
247 +MULTILIB_EXCEPTIONS=
248 +
249 +EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
250 --- /dev/null
251 +++ b/gcc/config/sh/t-sh64-uclibc
252 @@ -0,0 +1,13 @@
253 +EXTRA_MULTILIB_PARTS= crt1.o crti.o crtn.o crtbegin.o crtend.o
254 +
255 +LIB1ASMFUNCS = \
256 + _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \
257 + _shcompact_call_trampoline _shcompact_return_trampoline \
258 + _shcompact_incoming_args _ic_invalidate _nested_trampoline \
259 + _push_pop_shmedia_regs \
260 + _udivdi3 _divdi3 _umoddi3 _moddi3
261 +
262 +MULTILIB_OPTIONS = $(MULTILIB_ENDIAN) m5-32media-nofpu/m5-compact/m5-compact-nofpu/m5-64media/m5-64media-nofpu
263 +MULTILIB_DIRNAMES= $(MULTILIB_ENDIAN) nofpu compact nofpu/compact media64 nofpu/media64
264 +MULTILIB_MATCHES=
265 +MULTILIB_EXCEPTIONS=
266 --- /dev/null
267 +++ b/gcc/config/t-linux-uclibc
268 @@ -0,0 +1,15 @@
269 +T_CFLAGS = -DUSE_UCLIBC
270 +
271 +# Compile crtbeginS.o and crtendS.o with pic.
272 +CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
273 +# Compile libgcc2.a with pic.
274 +TARGET_LIBGCC2_CFLAGS = -fPIC
275 +
276 +# Override t-slibgcc-elf-ver to export some libgcc symbols with
277 +# the symbol versions that glibc used.
278 +#SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
279 +
280 +# Use unwind-dw2-fde
281 +LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
282 + $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c
283 +LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h
284 --- a/gcc/config.gcc
285 +++ b/gcc/config.gcc
286 @@ -676,6 +676,12 @@ arm*-*-netbsd*)
287 extra_parts=""
288 use_collect2=yes
289 ;;
290 +arm*-*-linux-uclibc*) # ARM GNU/Linux with ELF - uClibc
291 + 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"
292 + tmake_file="t-slibgcc-elf-ver t-linux-uclibc arm/t-linux"
293 + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
294 + gnu_ld=yes
295 + ;;
296 arm*-*-linux*) # ARM GNU/Linux with ELF
297 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"
298 tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
299 @@ -741,6 +747,10 @@ cris-*-elf | cris-*-none)
300 tmake_file="cris/t-cris cris/t-elfmulti"
301 gas=yes
302 ;;
303 +cris-*-linux-uclibc*)
304 + tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h"
305 + tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux-uclibc"
306 + ;;
307 cris-*-linux*)
308 tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h"
309 tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux"
310 @@ -1004,6 +1014,11 @@ i[34567]86-*-linux*libc1) # Intel 80386'
311 thread_file='single'
312 fi
313 ;;
314 +i[34567]86-*-linux*uclibc*) # Intel 80386's running GNU/Linux
315 + # with ELF format using uClibc
316 + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h i386/linux.h"
317 + tmake_file="t-slibgcc-elf-ver t-linux-uclibc i386/t-crtstuff"
318 + ;;
319 i[34567]86-*-linux*) # Intel 80386's running GNU/Linux
320 # with ELF format using glibc 2
321 # aka GNU/Linux C library 6
322 @@ -1563,6 +1578,16 @@ mips64*-*-linux*)
323 gnu_ld=yes
324 gas=yes
325 ;;
326 +mips*-*-linux-uclibc*) # Linux MIPS, either endian. uClibc
327 + tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
328 + case ${target} in
329 + mipsisa32*-*)
330 + target_cpu_default="MASK_SOFT_FLOAT"
331 + tm_defines="MIPS_ISA_DEFAULT=32"
332 + ;;
333 + esac
334 + tmake_file="t-slibgcc-elf-ver t-linux-uclibc"
335 + ;;
336 mips*-*-linux*) # Linux MIPS, either endian.
337 tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
338 case ${target} in
339 @@ -1776,6 +1801,10 @@ powerpc-*-linux*spe*)
340 tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxspe.h"
341 tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-linux rs6000/t-ppccomm"
342 ;;
343 +powerpc-*-linux-uclibc*)
344 + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h"
345 + tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-linux-uclibc rs6000/t-ppccomm"
346 + ;;
347 powerpc-*-linux*)
348 tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h"
349 tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-linux rs6000/t-ppccomm"
350 @@ -1940,7 +1969,7 @@ sh-*-rtems*)
351 tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/embed-elf.h sh/rtemself.h rtems.h"
352 ;;
353 sh-*-linux* | sh[2346lbe]*-*-linux*)
354 - tmake_file="sh/t-sh sh/t-elf t-slibgcc-elf-ver t-linux"
355 + tmake_file="sh/t-sh sh/t-elf t-slibgcc-elf-ver"
356 case ${target} in
357 sh*be-*-* | sh*eb-*-*) ;;
358 *)
359 @@ -1948,9 +1977,17 @@ sh-*-linux* | sh[2346lbe]*-*-linux*)
360 tmake_file="${tmake_file} sh/t-le"
361 ;;
362 esac
363 - tmake_file="${tmake_file} sh/t-linux"
364 + case ${target} in
365 + *-*-linux-uclibc*) tmake_file="${tmake_file} t-linux-uclibc sh/t-linux-uclibc" ;;
366 + *) tmake_file="${tmake_file} t-linux sh/t-linux" ;;
367 + esac
368 tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/linux.h"
369 case ${target} in
370 + sh64*-*-linux-uclibc*)
371 + tmake_file="${tmake_file} sh/t-sh64-uclibc"
372 + tm_file="${tm_file} sh/sh64.h"
373 + extra_headers="shmedia.h ushmedia.h sshmedia.h"
374 + ;;
375 sh64*)
376 tmake_file="${tmake_file} sh/t-sh64"
377 tm_file="${tm_file} sh/sh64.h"
378 --- a/libtool.m4
379 +++ b/libtool.m4
380 @@ -689,6 +689,11 @@ linux-gnu*)
381 lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
382 ;;
383
384 +linux-uclibc*)
385 + lt_cv_deplibs_check_method=pass_all
386 + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
387 + ;;
388 +
389 netbsd*)
390 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
391 [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
392 --- a/ltconfig
393 +++ b/ltconfig
394 @@ -602,6 +602,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
395
396 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
397 case $host_os in
398 +linux-uclibc*) ;;
399 linux-gnu*) ;;
400 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
401 esac
402 @@ -1262,6 +1263,24 @@ linux-gnu*)
403 dynamic_linker='GNU/Linux ld.so'
404 ;;
405
406 +linux-uclibc*)
407 + version_type=linux
408 + need_lib_prefix=no
409 + need_version=no
410 + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
411 + soname_spec='${libname}${release}.so$major'
412 + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
413 + shlibpath_var=LD_LIBRARY_PATH
414 + shlibpath_overrides_runpath=no
415 + # This implies no fast_install, which is unacceptable.
416 + # Some rework will be needed to allow for fast_install
417 + # before this can be enabled.
418 + # Note: copied from linux-gnu, and may not be appropriate.
419 + hardcode_into_libs=yes
420 + # Assume using the uClibc dynamic linker.
421 + dynamic_linker="uClibc ld.so"
422 + ;;
423 +
424 netbsd*)
425 need_lib_prefix=no
426 need_version=no