finally move buildroot-ng to trunk
[openwrt.git] / toolchain / gcc / patches / 3.4.5 / 100-uclibc-conf.patch
1 --- gcc-3.4.1/gcc/config.gcc
2 +++ gcc-3.4.1/gcc/config.gcc
3 @@ -2310,10 +2310,16 @@
4  *)
5         echo "*** Configuration ${target} not supported" 1>&2
6         exit 1
7         ;;
8  esac
9 +
10 +# Rather than hook into each target, just do it after all the linux
11 +# targets have been processed
12 +case ${target} in
13 +*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC"
14 +esac
15  
16  # Support for --with-cpu and related options (and a few unrelated options,
17  # too).
18  case ${with_cpu} in
19    yes | no)
20 --- gcc-3.4.4/gcc/config/alpha/linux-elf.h
21 +++ gcc-3.4.4/gcc/config/alpha/linux-elf.h
22 @@ -27,7 +27,11 @@
23  #define SUBTARGET_EXTRA_SPECS \
24  { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
25  
26 +#ifdef USE_UCLIBC
27 +#define ELF_DYNAMIC_LINKER     "/lib/ld-uClibc.so.0"
28 +#else
29  #define ELF_DYNAMIC_LINKER     "/lib/ld-linux.so.2"
30 +#endif
31  
32  #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax}         \
33    %{O*:-O3} %{!O*:-O1}                                         \
34 --- gcc-3.4.1-dist/gcc/config/arm/linux-elf.h   2004-01-31 00:18:11.000000000 -0600
35 +++ gcc-3.4.1/gcc/config/arm/linux-elf.h        2004-08-12 15:54:42.000000000 -0500
36 @@ -80,14 +80,19 @@
37  #define ENDFILE_SPEC \
38    "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
39  
40 +#ifdef USE_UCLIBC
41 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
42 +#else
43 +#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
44 +#endif
45  #undef  LINK_SPEC
46  #define LINK_SPEC "%{h*} %{version:-v} \
47     %{b} %{Wl,*:%*} \
48     %{static:-Bstatic} \
49     %{shared:-shared} \
50     %{symbolic:-Bsymbolic} \
51     %{rdynamic:-export-dynamic} \
52 -   %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
53 +   %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \
54     -X \
55     %{mbig-endian:-EB}" \
56     SUBTARGET_EXTRA_LINK_SPEC
57 --- gcc-3.4.1-dist/gcc/config/cris/linux.h      2003-11-28 21:08:09.000000000 -0600
58 +++ gcc-3.4.1/gcc/config/cris/linux.h   2004-08-12 15:54:43.000000000 -0500
59 @@ -79,6 +79,25 @@
60  #undef CRIS_DEFAULT_CPU_VERSION
61  #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
62  
63 +#ifdef USE_UCLIBC
64 +
65 +#undef CRIS_SUBTARGET_VERSION
66 +#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
67 +
68 +#undef CRIS_LINK_SUBTARGET_SPEC
69 +#define CRIS_LINK_SUBTARGET_SPEC \
70 + "-mcrislinux\
71 +  -rpath-link include/asm/../..%s\
72 +  %{shared} %{static}\
73 +  %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\
74 +  %{!shared: \
75 +    %{!static: \
76 +      %{rdynamic:-export-dynamic} \
77 +      %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \
78 +  %{!r:%{O2|O3: --gc-sections}}"
79 +
80 +#else  /* USE_UCLIBC */
81 +
82  #undef CRIS_SUBTARGET_VERSION
83  #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
84  
85 @@ -93,6 +112,8 @@
86    %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\
87    %{!r:%{O2|O3: --gc-sections}}"
88  
89 +#endif  /* USE_UCLIBC */
90 +
91  
92  /* Node: Run-time Target */
93  
94 --- gcc-3.4.1-dist/gcc/config/i386/linux.h      2003-11-28 21:08:10.000000000 -0600
95 +++ gcc-3.4.1/gcc/config/i386/linux.h   2004-08-12 15:54:43.000000000 -0500
96 @@ -110,22 +110,21 @@
97  
98  #undef LINK_SPEC
99  #ifdef USE_GNULIBC_1
100 -#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
101 -  %{!shared: \
102 -    %{!ibcs: \
103 -      %{!static: \
104 -       %{rdynamic:-export-dynamic} \
105 -       %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
106 -       %{static:-static}}}"
107 +#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.1"
108 +#else
109 +#ifdef USE_UCLIBC
110 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
111  #else
112 +#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
113 +#endif
114 +#endif
115  #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
116    %{!shared: \
117      %{!ibcs: \
118        %{!static: \
119         %{rdynamic:-export-dynamic} \
120 -       %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
121 +       %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
122         %{static:-static}}}"
123 -#endif
124  
125  /* A C statement (sans semicolon) to output to the stdio stream
126     FILE the assembler definition of uninitialized global DECL named
127 --- gcc-3.4.4/gcc/config/i386/linux64.h
128 +++ gcc-3.4.4/gcc/config/i386/linux64.h
129 @@ -54,14 +54,21 @@
130     When the -shared link option is used a final link is not being
131     done.  */
132  
133 +#ifdef USE_UCLIBC
134 +#define ELF32_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
135 +#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
136 +#else
137 +#define ELF32_DYNAMIC_LINKER "/lib/ld-linux.so.2"
138 +#define ELF64_DYNAMIC_LINKER "/lib64/ld-linux-x86-64.so.2"
139 +#endif
140  #undef LINK_SPEC
141  #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
142    %{shared:-shared} \
143    %{!shared: \
144      %{!static: \
145        %{rdynamic:-export-dynamic} \
146 -      %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
147 -      %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \
148 +      %{m32:%{!dynamic-linker:-dynamic-linker " ELF32_DYNAMIC_LINKER "}} \
149 +      %{!m32:%{!dynamic-linker:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}} \
150      %{static:-static}}"
151  
152  #define MULTILIB_DEFAULTS { "m64" }
153 --- gcc-3.4.4/gcc/config/ia64/linux.h
154 +++ gcc-3.4.4/gcc/config/ia64/linux.h
155 @@ -37,13 +37,18 @@
156  /* Define this for shared library support because it isn't in the main
157     linux.h file.  */
158  
159 +#ifdef USE_UCLIBC
160 +#define ELF_DYNAMIC_LINKER     "/lib/ld-uClibc.so.0"
161 +#else
162 +#define ELF_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
163 +#endif
164  #undef LINK_SPEC
165  #define LINK_SPEC "\
166    %{shared:-shared} \
167    %{!shared: \
168      %{!static: \
169        %{rdynamic:-export-dynamic} \
170 -      %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \
171 +      %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
172        %{static:-static}}"
173  
174  
175 --- gcc-3.4.4/gcc/config/m68k/linux.h
176 +++ gcc-3.4.4/gcc/config/m68k/linux.h
177 @@ -131,12 +131,17 @@
178  
179  /* If ELF is the default format, we should not use /lib/elf.  */
180  
181 +#ifdef USE_UCLIBC
182 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
183 +#else
184 +#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
185 +#endif
186  #undef LINK_SPEC
187  #define LINK_SPEC "-m m68kelf %{shared} \
188    %{!shared: \
189      %{!static: \
190        %{rdynamic:-export-dynamic} \
191 -      %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \
192 +      %{!dynamic-linker*:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
193      %{static}}"
194  
195  /* For compatibility with linux/a.out */
196 --- gcc-3.4.1-dist/gcc/config/mips/linux.h      2004-06-15 20:42:24.000000000 -0500
197 +++ gcc-3.4.1/gcc/config/mips/linux.h   2004-08-12 15:54:43.000000000 -0500
198 @@ -109,14 +109,19 @@
199  
200  /* Borrowed from sparc/linux.h */
201  #undef LINK_SPEC
202 +#ifdef USE_UCLIBC
203 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
204 +#else
205 +#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
206 +#endif
207  #define LINK_SPEC \
208   "%(endian_spec) \
209    %{shared:-shared} \
210    %{!shared: \
211      %{!ibcs: \
212        %{!static: \
213          %{rdynamic:-export-dynamic} \
214 -        %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
215 +        %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
216          %{static:-static}}}"
217  
218  #undef SUBTARGET_ASM_SPEC
219 --- gcc-3.4.4/gcc/config/pa/pa-linux.h
220 +++ gcc-3.4.4/gcc/config/pa/pa-linux.h
221 @@ -77,13 +77,18 @@
222  /* Define this for shared library support because it isn't in the main
223     linux.h file.  */
224  
225 +#ifdef USE_UCLIBC
226 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
227 +#else
228 +#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
229 +#endif
230  #undef LINK_SPEC
231  #define LINK_SPEC "\
232    %{shared:-shared} \
233    %{!shared: \
234      %{!static: \
235        %{rdynamic:-export-dynamic} \
236 -      %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
237 +      %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
238        %{static:-static}}"
239  
240  /* glibc's profiling functions don't need gcc to allocate counters.  */
241 --- gcc-3.4.1-dist/gcc/config/rs6000/linux.h    2004-02-25 09:11:19.000000000 -0600
242 +++ gcc-3.4.1/gcc/config/rs6000/linux.h 2004-08-12 15:54:43.000000000 -0500
243 @@ -69,7 +69,11 @@
244  #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
245  
246  #undef LINK_OS_DEFAULT_SPEC
247 +#ifdef USE_UCLIBC
248 +#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)"
249 +#else
250  #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
251 +#endif
252  
253  #define LINK_GCC_C_SEQUENCE_SPEC \
254    "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
255 --- gcc-3.4.1-dist/gcc/config/rs6000/sysv4.h    2004-06-10 01:39:50.000000000 -0500
256 +++ gcc-3.4.1/gcc/config/rs6000/sysv4.h 2004-08-12 15:54:43.000000000 -0500
257 @@ -947,6 +947,7 @@
258    mcall-linux  : %(link_os_linux)       ; \
259    mcall-gnu    : %(link_os_gnu)         ; \
260    mcall-netbsd : %(link_os_netbsd)      ; \
261 +  mcall-linux-uclibc : %(link_os_linux_uclibc); \
262    mcall-openbsd: %(link_os_openbsd)     ; \
263                 : %(link_os_default)     }"
264  
265 @@ -1125,6 +1126,10 @@
266    %{rdynamic:-export-dynamic} \
267    %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
268  
269 +#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \
270 +  %{rdynamic:-export-dynamic} \
271 +  %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}"
272 +
273  #if defined(HAVE_LD_EH_FRAME_HDR)
274  # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
275  #endif
276 @@ -1291,6 +1296,7 @@
277    { "link_os_sim",             LINK_OS_SIM_SPEC },                     \
278    { "link_os_freebsd",         LINK_OS_FREEBSD_SPEC },                 \
279    { "link_os_linux",           LINK_OS_LINUX_SPEC },                   \
280 +  { "link_os_linux_uclibc",    LINK_OS_LINUX_UCLIBC_SPEC },            \
281    { "link_os_gnu",             LINK_OS_GNU_SPEC },                     \
282    { "link_os_netbsd",          LINK_OS_NETBSD_SPEC },                  \
283    { "link_os_openbsd",         LINK_OS_OPENBSD_SPEC },                 \
284 --- gcc-3.4.4/gcc/config/s390/linux.h
285 +++ gcc-3.4.4/gcc/config/s390/linux.h
286 @@ -77,6 +77,13 @@
287  #define MULTILIB_DEFAULTS { "m31" }
288  #endif
289  
290 +#ifdef USE_UCLIBC
291 +#define ELF31_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
292 +#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
293 +#else
294 +#define ELF31_DYNAMIC_LINKER "/lib/ld.so.1"
295 +#define ELF64_DYNAMIC_LINKER "/lib/ld64.so.1"
296 +#endif
297  #undef  LINK_SPEC
298  #define LINK_SPEC \
299    "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
300 @@ -86,8 +93,8 @@
301        %{!static: \
302         %{rdynamic:-export-dynamic} \
303         %{!dynamic-linker: \
304 -          %{m31:-dynamic-linker /lib/ld.so.1} \
305 -          %{m64:-dynamic-linker /lib/ld64.so.1}}}}"
306 +          %{m31:-dynamic-linker " ELF31_DYNAMIC_LINKER "} \
307 +          %{m64:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}}}"
308  
309  
310  #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
311 --- gcc-3.4.1-dist/gcc/config/sh/linux.h        2004-01-11 20:29:13.000000000 -0600
312 +++ gcc-3.4.1/gcc/config/sh/linux.h     2004-08-12 15:54:43.000000000 -0500
313 @@ -73,11 +73,16 @@
314  #undef SUBTARGET_LINK_EMUL_SUFFIX
315  #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
316  #undef SUBTARGET_LINK_SPEC
317 +#ifdef USE_UCLIBC
318 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
319 +#else
320 +#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
321 +#endif
322  #define SUBTARGET_LINK_SPEC \
323    "%{shared:-shared} \
324     %{!static: \
325       %{rdynamic:-export-dynamic} \
326 -     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
327 +     %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
328     %{static:-static}"
329  
330  #undef LIB_SPEC
331 --- gcc-3.4.4/gcc/config/sparc/linux.h
332 +++ gcc-3.4.4/gcc/config/sparc/linux.h
333 @@ -162,13 +162,18 @@
334          %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
335          %{static:-static}}}"
336  #else
337 +#ifdef USE_UCLIBC
338 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
339 +#else
340 +#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
341 +#endif
342  #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
343    %{!mno-relax:%{!r:-relax}} \
344    %{!shared: \
345      %{!ibcs: \
346        %{!static: \
347          %{rdynamic:-export-dynamic} \
348 -        %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
349 +        %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
350          %{static:-static}}}"
351  #endif
352  
353 --- gcc-3.4.4/gcc/config/sparc/linux64.h
354 +++ gcc-3.4.4/gcc/config/sparc/linux64.h
355 @@ -167,12 +166,17 @@
356    { "link_arch_default", LINK_ARCH_DEFAULT_SPEC },       \
357    { "link_arch",        LINK_ARCH_SPEC },
358      
359 +#ifdef USE_UCLIBC
360 +#define ELF_DYNAMIC_LINKER     "/lib/ld-uClibc.so.0"
361 +#else
362 +#define ELF_DYNAMIC_LINKER  "/lib/ld-linux.so.2"
363 +#endif
364  #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
365    %{!shared: \
366      %{!ibcs: \
367        %{!static: \
368          %{rdynamic:-export-dynamic} \
369 -        %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
370 +        %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
371          %{static:-static}}} \
372  "
373  
374 --- gcc-3.4.1-dist/libtool.m4   2004-05-18 04:08:37.000000000 -0500
375 +++ gcc-3.4.1/libtool.m4        2004-08-12 15:54:43.000000000 -0500
376 @@ -689,6 +689,11 @@
377    lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
378    ;;
379  
380 +linux-uclibc*)
381 +  lt_cv_deplibs_check_method=pass_all
382 +  lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
383 +  ;;
384 +
385  netbsd*)
386    if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
387      [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
388 --- gcc-3.4.1-dist/ltconfig     2004-03-05 15:05:41.000000000 -0600
389 +++ gcc-3.4.1/ltconfig  2004-08-12 15:55:48.000000000 -0500
390 @@ -602,6 +602,7 @@
391  
392  # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
393  case $host_os in
394 +linux-uclibc*) ;;
395  linux-gnu*) ;;
396  linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
397  esac
398 @@ -1262,6 +1263,24 @@
399    dynamic_linker='GNU/Linux ld.so'
400    ;;
401  
402 +linux-uclibc*)
403 +  version_type=linux
404 +  need_lib_prefix=no
405 +  need_version=no
406 +  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
407 +  soname_spec='${libname}${release}.so$major'
408 +  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
409 +  shlibpath_var=LD_LIBRARY_PATH
410 +  shlibpath_overrides_runpath=no
411 +  # This implies no fast_install, which is unacceptable.
412 +  # Some rework will be needed to allow for fast_install
413 +  # before this can be enabled.
414 +  # Note: copied from linux-gnu, and may not be appropriate.
415 +  hardcode_into_libs=yes
416 +  # Assume using the uClibc dynamic linker.
417 +  dynamic_linker="uClibc ld.so"
418 +  ;;
419 +
420  netbsd*)
421    need_lib_prefix=no
422    need_version=no
423 --- gcc-3.4.1-dist/boehm-gc/configure   2004-07-01 14:14:03.000000000 -0500
424 +++ gcc-3.4.1/boehm-gc/configure        2004-08-12 16:22:57.000000000 -0500
425 @@ -1947,6 +1947,11 @@
426    lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
427    ;;
428  
429 +linux-uclibc*)
430 +  lt_cv_deplibs_check_method=pass_all
431 +  lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
432 +  ;;
433 +
434  netbsd*)
435    if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
436      lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
437 --- gcc-3.4.1-dist/boehm-gc/ltconfig    2002-11-20 09:59:06.000000000 -0600
438 +++ gcc-3.4.1/boehm-gc/ltconfig 2004-08-12 15:54:42.000000000 -0500
439 @@ -1981,6 +1981,23 @@
440    fi
441    ;;
442  
443 +linux-uclibc*)
444 +  version_type=linux
445 +  need_lib_prefix=no
446 +  need_version=no
447 +  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
448 +  soname_spec='${libname}${release}.so$major'
449 +  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
450 +  shlibpath_var=LD_LIBRARY_PATH
451 +  shlibpath_overrides_runpath=no
452 +  deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
453 +  file_magic_cmd=/usr/bin/file
454 +  file_magic_test_file=`echo /lib/libuClibc-*.so`
455 +
456 +  # Assume using the uClibc dynamic linker.
457 +  dynamic_linker="uClibc ld.so"
458 +  ;;
459 +
460  netbsd*)
461    version_type=sunos
462    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then