summaryrefslogtreecommitdiffstats
path: root/main/gcc/gcc-4.6-dynamic-linker.patch
blob: a6b235cd1993d258639184c0b829425b0dd6a342 (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
commit d929f627aba264e63cf779cd4ca51af97b076445
Author: Natanael Copa <ncopa@alpinelinux.org>
Date:   Tue Sep 28 09:45:17 2010 +0000

    Submitted By:            Kevin Day <thekevinday AT gmail DOT com>
    Date:                    2008-12-19
    Initial Package Version: 4.3.2
    Upstream Status:         Not submitted
    Description:             Why not just be able to define the prefix of the dynamic linker instead of hardcoding it..
    This includes the --nostdinc patch as well, so think of this as a specs-3 patch
    This also allows for specifying the dynamic-linker as well

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index ae2416b..b0b9b2c 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -971,7 +971,7 @@ INTERNAL_CFLAGS = -DIN_GCC @CROSS@
 # This is the variable actually used when we compile. If you change this,
 # you probably want to update BUILD_CFLAGS in configure.ac
 ALL_CFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) \
-  $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@
+  $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@ @NOSTDINC@
 
 # The C++ version.
 ALL_CXXFLAGS = $(T_CFLAGS) $(CXXFLAGS) $(INTERNAL_CFLAGS) \
@@ -2105,6 +2105,8 @@ DRIVER_DEFINES = \
   -DSTANDARD_STARTFILE_PREFIX=\"$(unlibsubdir)/\" \
   -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
   -DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \
+  -DDYNAMIC_LINKER_PREFIX=\"@DYNAMICLINKERPREFIX@\" \
+  -DDYNAMIC_LINKER=\"@DYNAMICLINKER@\" \
   -DDEFAULT_TARGET_VERSION=\"$(version)\" \
   -DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\" \
   -DSTANDARD_BINDIR_PREFIX=\"$(bindir)/\" \
diff --git a/gcc/config/alpha/gnu.h b/gcc/config/alpha/gnu.h
index f98c3e7..bd16dcf 100644
--- a/gcc/config/alpha/gnu.h
+++ b/gcc/config/alpha/gnu.h
@@ -34,7 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
     } while (0)
 
 #undef ELF_DYNAMIC_LINKER
-#define ELF_DYNAMIC_LINKER	"/lib/ld.so"
+#define ELF_DYNAMIC_LINKER	DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #undef	STARTFILE_SPEC
 #define STARTFILE_SPEC \
diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
index c48fc93..3068717 100644
--- a/gcc/config/alpha/linux-elf.h
+++ b/gcc/config/alpha/linux-elf.h
@@ -27,8 +27,8 @@ along with GCC; see the file COPYING3.  If not see
 #define EXTRA_SPECS \
 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
 
-#define GLIBC_DYNAMIC_LINKER	"/lib/ld-linux.so.2"
-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
+#define GLIBC_DYNAMIC_LINKER	DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
+#define UCLIBC_DYNAMIC_LINKER   DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 #if DEFAULT_LIBC == LIBC_UCLIBC
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
 #else
diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
index fce1ed1..c3bcd50 100644
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -61,7 +61,7 @@
 /* Use ld-linux.so.3 so that it will be possible to run "classic"
    GNU/Linux binaries on an EABI system.  */
 #undef  GLIBC_DYNAMIC_LINKER
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
    use the GNU/Linux version, not the generic BPABI version.  */
diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
index 9fdca41..65b0a5a 100644
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -62,7 +62,7 @@
 
 #define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #define LINUX_TARGET_LINK_SPEC  "%{h*} %{version:-v} \
    %{b} \
diff --git a/gcc/config/bfin/linux.h b/gcc/config/bfin/linux.h
index 5c716cd..b5e464e 100644
--- a/gcc/config/bfin/linux.h
+++ b/gcc/config/bfin/linux.h
@@ -45,7 +45,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   %{shared:-G -Bdynamic} \
   %{!shared: %{!static: \
    %{rdynamic:-export-dynamic} \
-   -dynamic-linker /lib/ld-uClibc.so.0} \
+   -dynamic-linker DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER} \
    %{static}} -init __init -fini __fini"
 
 #define MD_UNWIND_SUPPORT "config/bfin/linux-unwind.h"
diff --git a/gcc/config/cris/linux.h b/gcc/config/cris/linux.h
index 38f0a7e..6893407 100644
--- a/gcc/config/cris/linux.h
+++ b/gcc/config/cris/linux.h
@@ -103,7 +103,7 @@ along with GCC; see the file COPYING3.  If not see
 #undef CRIS_DEFAULT_CPU_VERSION
 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 /* We need an -rpath-link to ld.so.1, and presumably to each directory
    specified with -B.  */
diff --git a/gcc/config/freebsd-spec.h b/gcc/config/freebsd-spec.h
index 84d8127..fb3e79a 100644
--- a/gcc/config/freebsd-spec.h
+++ b/gcc/config/freebsd-spec.h
@@ -144,9 +144,9 @@ is built with the --enable-threads configure-time option.}		\
 #endif
 
 #if FBSD_MAJOR < 6
-#define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1"
+#define FBSD_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 #else
-#define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
+#define FBSD_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 #endif
 
 #if defined(HAVE_LD_EH_FRAME_HDR)
diff --git a/gcc/config/frv/linux.h b/gcc/config/frv/linux.h
index 71cd094..221d01d 100644
--- a/gcc/config/frv/linux.h
+++ b/gcc/config/frv/linux.h
@@ -35,7 +35,7 @@
 #define ENDFILE_SPEC \
   "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #undef LINK_SPEC
 #define LINK_SPEC "\
diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
index 2a31880..9c08adb 100644
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
@@ -100,7 +100,7 @@ along with GCC; see the file COPYING3.  If not see
 
 /* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
 #define LINK_EMULATION "elf_i386"
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #undef  ASM_SPEC
 #define ASM_SPEC \
diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
index 867de59..274acca 100644
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
@@ -58,8 +58,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    When the -shared link option is used a final link is not being
    done.  */
 
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+#define GLIBC_DYNAMIC_LINKER32 "/" DYNAMIC_LINKER
+#define GLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #if TARGET_64BIT_DEFAULT
 #define SPEC_32 "m32"
diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h
index 587a4f4..450fcb5 100644
--- a/gcc/config/ia64/linux.h
+++ b/gcc/config/ia64/linux.h
@@ -61,7 +61,7 @@ do {						\
 /* Define this for shared library support because it isn't in the main
    linux.h file.  */
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
+#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #undef LINK_SPEC
 #define LINK_SPEC "\
diff --git a/gcc/config/knetbsd-gnu.h b/gcc/config/knetbsd-gnu.h
index 4cc8eb7..bb7a063 100644
--- a/gcc/config/knetbsd-gnu.h
+++ b/gcc/config/knetbsd-gnu.h
@@ -34,5 +34,5 @@ along with GCC; see the file COPYING3.  If not see
 
 #ifdef GLIBC_DYNAMIC_LINKER
 #undef GLIBC_DYNAMIC_LINKER
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER  DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 #endif
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index e567e9a..c052fd0 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -117,9 +117,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
    GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
    supporting both 32-bit and 64-bit compilation.  */
-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
+#define UCLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
+#define UCLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
+#define UCLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
@@ -135,3 +135,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 /* Whether we have sincos that follows the GNU extension.  */
 #define TARGET_HAS_SINCOS (OPTION_GLIBC || OPTION_BIONIC)
+
+#ifdef NOSTDINC
+#undef STANDARD_INCLUDE_DIR
+#define STANDARD_INCLUDE_DIR 0
+#endif
diff --git a/gcc/config/m32r/linux.h b/gcc/config/m32r/linux.h
index 0515e5b..019e850 100644
--- a/gcc/config/m32r/linux.h
+++ b/gcc/config/m32r/linux.h
@@ -58,7 +58,7 @@
 
 /* If ELF is the default format, we should not use /lib/elf.  */
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #undef	LINK_SPEC
 #if TARGET_LITTLE_ENDIAN
diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h
index 1d73ee0..e57cf50 100644
--- a/gcc/config/m68k/linux.h
+++ b/gcc/config/m68k/linux.h
@@ -84,7 +84,7 @@ along with GCC; see the file COPYING3.  If not see
 
 /* If ELF is the default format, we should not use /lib/elf.  */
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #undef LINK_SPEC
 #define LINK_SPEC "-m m68kelf %{shared} \
diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
index 0512ef7..7efe2fd 100644
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
@@ -64,7 +64,7 @@ along with GCC; see the file COPYING3.  If not see
 #undef MIPS_DEFAULT_GVALUE
 #define MIPS_DEFAULT_GVALUE 0
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 /* Borrowed from sparc/linux.h */
 #undef LINK_SPEC
diff --git a/gcc/config/mips/linux64.h b/gcc/config/mips/linux64.h
index 2f24dfa..850cb22 100644
--- a/gcc/config/mips/linux64.h
+++ b/gcc/config/mips/linux64.h
@@ -35,10 +35,10 @@ along with GCC; see the file COPYING3.  If not see
 %{!shared: \
   %{profile:-lc_p} %{!profile:-lc}}"
 
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1"
-#define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
-#define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
-#define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
+#define GLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
+#define GLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
+#define GLIBC_DYNAMIC_LINKERN32 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
+#define UCLIBC_DYNAMIC_LINKERN32 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
+#define BIONIC_DYNAMIC_LINKERN32 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 #define LINUX_DYNAMIC_LINKERN32 \
   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
 			 BIONIC_DYNAMIC_LINKERN32)
diff --git a/gcc/config/mn10300/linux.h b/gcc/config/mn10300/linux.h
index ac9f8c5..8ab78b1 100644
--- a/gcc/config/mn10300/linux.h
+++ b/gcc/config/mn10300/linux.h
@@ -32,7 +32,7 @@
 #undef  ASM_SPEC
 #define ASM_SPEC "%{Wa,*:%*}"
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #undef  LINK_SPEC
 #define LINK_SPEC "%{mrelax:--relax} %{shared:-shared} \
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index da7bca3..c36e7d6 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -348,10 +348,10 @@ extern int dot_symbols;
 #undef	LINK_OS_DEFAULT_SPEC
 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
 
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
+#define GLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
+#define GLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
+#define UCLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
+#define UCLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 #if DEFAULT_LIBC == LIBC_UCLIBC
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
 #elif DEFAULT_LIBC == LIBC_GLIBC
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
index ddbcfa9..59bfd28 100644
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -72,8 +72,8 @@ along with GCC; see the file COPYING3.  If not see
 #define MULTILIB_DEFAULTS { "m31" }
 #endif
 
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
-#define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
+#define GLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
+#define GLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #undef  LINK_SPEC
 #define LINK_SPEC \
diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
index d513af8..2ad27a7 100644
--- a/gcc/config/sh/linux.h
+++ b/gcc/config/sh/linux.h
@@ -47,7 +47,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #undef SUBTARGET_LINK_EMUL_SUFFIX
 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
index b12c881..83bdd8e 100644
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -83,7 +83,7 @@ along with GCC; see the file COPYING3.  If not see
 
 /* If ELF is the default format, we should not use /lib/elf.  */
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #undef  LINK_SPEC
 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
index c2e78d7..8481a34 100644
--- a/gcc/config/sparc/linux64.h
+++ b/gcc/config/sparc/linux64.h
@@ -109,8 +109,8 @@ along with GCC; see the file COPYING3.  If not see
 
 /* If ELF is the default format, we should not use /lib/elf.  */
 
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER32 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
+#define GLIBC_DYNAMIC_LINKER64 DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #ifdef SPARC_BI_ARCH
 
diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h
index 69ab626..ebc8e0b 100644
--- a/gcc/config/xtensa/linux.h
+++ b/gcc/config/xtensa/linux.h
@@ -43,7 +43,7 @@ along with GCC; see the file COPYING3.  If not see
   %{mlongcalls:--longcalls} \
   %{mno-longcalls:--no-longcalls}"
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER DYNAMIC_LINKER_PREFIX "/" DYNAMIC_LINKER
 
 #undef LINK_SPEC
 #define LINK_SPEC \
diff --git a/gcc/configure b/gcc/configure
index b623a4a..230719b 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -757,6 +757,9 @@ AWK
 SET_MAKE
 REPORT_BUGS_TEXI
 REPORT_BUGS_TO
+DYNAMICLINKER
+DYNAMICLINKERPREFIX
+NOSTDINC
 PKGVERSION
 onestep
 CONFIGURE_SPECS
@@ -1657,6 +1660,14 @@ Optional Packages:
   --with-gc={page,zone}   choose the garbage collection mechanism to use
                           with the compiler
   --with-system-zlib      use installed libz
+  --with-dynamic-linker=PATH
+                          specifies path to dynamic linker.
+                          example: "/lib/ld-linux.so.2", where this defines "ld-linux.so.2"
+  --with-dynamic-linker-prefix=PATH
+                          specifies path to dynamic linker.
+                          example: "/lib/ld-linux.so.2", where this defines "/lib"
+  --with-nostdinc         build gcc to ignore standard include directories.
+                          You will have to use --with-local-prefix with this option.
   --with-slibdir=DIR      shared libraries in DIR [LIBDIR]
 
 Some influential environment variables:
@@ -6065,6 +6076,47 @@ fi
 
 
 
+# Check whether --with-dynamic-linker was given.
+
+DYNAMICLINKER="ld-linux.so.2" ;
+if test "${with_dynamic_linker+set}" = set; then
+  withval="$with_dynamic_linker"
+  case "${withval}" in
+yes)    { { echo "$as_me:$LINENO: error: bad value "${withval}". Use something like --with-dynamic-linker=$DYNAMICLINKER" >&5
+echo "$as_me: error: bad value "${withval}". Use something like --with-dynamic-linker=$DYNAMICLINKER" >&2;}
+   { (exit 1); exit 1; }; } ;;
+no)     ;;
+*)     DYNAMICLINKER=$withval ;;
+esac
+fi;
+
+# Check whether --with-dynamic-linker-prefix= was given.
+
+DYNAMICLINKERPREFIX="/lib" ;
+if test "${with_dynamic_linker_prefix+set}" = set; then
+  withval="$with_dynamic_linker_prefix"
+  case "${withval}" in
+yes)    { { echo "$as_me:$LINENO: error: bad value "${withval}". Use --with-dynamic-linker-prefix=/path/to/lib/" >&5
+echo "$as_me: error: bad value "${withval}". Use --with-dynamic-linker-prefix=/path/to/lib/" >&2;}
+   { (exit 1); exit 1; }; } ;;
+no)     ;;
+*)     DYNAMICLINKERPREFIX=$withval ;;
+esac
+
+fi;
+
+# Check whether --with-nostdinc was given.
+
+if test "${with_nostdinc+set}" = set; then
+  withval="$with_nostdinc"
+  case "${withval}" in
+yes)   NOSTDINC="-DNOSTDINC" ;;
+no)    ;;
+*)     NOSTDINC="-DNOSTDINC" ;;
+esac
+fi;
+
+
 
 # ---------------------
 # Warnings and checking