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