2 +++ b/gcc/config/t-linux-uclibc
4 +# Remove glibc specific files added in t-linux
5 +SHLIB_MAPFILES := $(filter-out $(srcdir)/config/libgcc-glibc.ver, $(SHLIB_MAPFILES))
7 +# Use unwind-dw2-fde instead of unwind-dw2-fde-glibc
8 +LIB2ADDEH := $(subst unwind-dw2-fde-glibc.c,unwind-dw2-fde.c,$(LIB2ADDEH))
11 @@ -1884,7 +1884,7 @@ s390x-ibm-tpf*)
13 sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \
14 sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
15 - sh-*-linux* | sh[346lbe]*-*-linux* | \
16 + sh*-*-linux* | sh[346lbe]*-*-linux* | \
17 sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
18 sh64-*-netbsd* | sh64l*-*-netbsd*)
19 tmake_file="${tmake_file} sh/t-sh sh/t-elf"
20 @@ -2338,6 +2338,12 @@ m32c-*-elf*)
24 +# Rather than hook into each target, just do it after all the linux
25 +# targets have been processed
27 +*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC" ; tmake_file="${tmake_file} t-linux-uclibc"
31 i[34567]86-*-linux*aout* | i[34567]86-*-linux*libc1)
32 tmake_file="${tmake_file} i386/t-gmm_malloc"
33 --- a/boehm-gc/configure
34 +++ b/boehm-gc/configure
35 @@ -4320,6 +4320,11 @@ linux-gnu*)
36 lt_cv_deplibs_check_method=pass_all
40 + lt_cv_deplibs_check_method=pass_all
41 + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
44 netbsd* | knetbsd*-gnu)
45 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
46 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
49 @@ -1133,7 +1133,7 @@ no)
53 - *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
54 + *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*)
55 # Enable libmudflap by default in GNU and friends.
60 @@ -341,7 +341,7 @@ no)
64 - *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
65 + *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*)
66 # Enable libmudflap by default in GNU and friends.
69 --- a/contrib/regression/objs-gcc.sh
70 +++ b/contrib/regression/objs-gcc.sh
71 @@ -105,6 +105,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
73 make all-gdb all-dejagnu all-ld || exit 1
74 make install-gdb install-dejagnu install-ld || exit 1
75 +elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
77 + make all-gdb all-dejagnu all-ld || exit 1
78 + make install-gdb install-dejagnu install-ld || exit 1
79 elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
80 make bootstrap || exit 1
81 make install || exit 1
82 --- a/gcc/config/alpha/linux-elf.h
83 +++ b/gcc/config/alpha/linux-elf.h
84 @@ -27,7 +27,11 @@ Boston, MA 02110-1301, USA. */
85 #define SUBTARGET_EXTRA_SPECS \
86 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
88 +#if defined USE_UCLIBC
89 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
91 #define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
94 #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
95 %{O*:-O3} %{!O*:-O1} \
96 --- a/gcc/config/arm/linux-elf.h
97 +++ b/gcc/config/arm/linux-elf.h
100 #define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
103 +#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0"
105 #define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.2"
108 #define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v} \
110 --- a/gcc/config/cris/linux.h
111 +++ b/gcc/config/cris/linux.h
112 @@ -73,6 +73,25 @@ Boston, MA 02110-1301, USA. */
113 #undef CRIS_DEFAULT_CPU_VERSION
114 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
118 +#undef CRIS_SUBTARGET_VERSION
119 +#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
121 +#undef CRIS_LINK_SUBTARGET_SPEC
122 +#define CRIS_LINK_SUBTARGET_SPEC \
124 + -rpath-link include/asm/../..%s\
125 + %{shared} %{static}\
126 + %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\
129 + %{rdynamic:-export-dynamic} \
130 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \
131 + %{!r:%{O2|O3: --gc-sections}}"
133 +#else /* USE_UCLIBC */
135 #undef CRIS_SUBTARGET_VERSION
136 #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
138 @@ -87,6 +106,8 @@ Boston, MA 02110-1301, USA. */
139 %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\
140 %{!r:%{O2|O3: --gc-sections}}"
142 +#endif /* USE_UCLIBC */
145 /* Node: Run-time Target */
147 --- a/gcc/config/i386/linux.h
148 +++ b/gcc/config/i386/linux.h
149 @@ -107,6 +107,11 @@ Boston, MA 02110-1301, USA. */
150 #define LINK_EMULATION "elf_i386"
151 #define DYNAMIC_LINKER "/lib/ld-linux.so.2"
153 +#if defined USE_UCLIBC
154 +#undef DYNAMIC_LINKER
155 +#define DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
158 #undef SUBTARGET_EXTRA_SPECS
159 #define SUBTARGET_EXTRA_SPECS \
160 { "link_emulation", LINK_EMULATION },\
161 --- a/gcc/config/i386/linux64.h
162 +++ b/gcc/config/i386/linux64.h
163 @@ -54,14 +54,21 @@ Boston, MA 02110-1301, USA. */
164 When the -shared link option is used a final link is not being
168 +#define ELF32_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
169 +#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
171 +#define ELF32_DYNAMIC_LINKER "/lib/ld-linux.so.2"
172 +#define ELF64_DYNAMIC_LINKER "/lib64/ld-linux-x86-64.so.2"
175 #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
179 %{rdynamic:-export-dynamic} \
180 - %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
181 - %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \
182 + %{m32:%{!dynamic-linker:-dynamic-linker " ELF32_DYNAMIC_LINKER "}} \
183 + %{!m32:%{!dynamic-linker:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}} \
186 /* Similar to standard Linux, but adding -ffast-math support. */
187 --- a/gcc/config/ia64/linux.h
188 +++ b/gcc/config/ia64/linux.h
189 @@ -37,13 +37,18 @@ do { \
190 /* Define this for shared library support because it isn't in the main
194 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
196 +#define ELF_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
203 %{rdynamic:-export-dynamic} \
204 - %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \
205 + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
208 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
209 --- a/gcc/config/m68k/linux.h
210 +++ b/gcc/config/m68k/linux.h
211 @@ -123,12 +123,17 @@ Boston, MA 02110-1301, USA. */
213 /* If ELF is the default format, we should not use /lib/elf. */
216 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
218 +#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
221 #define LINK_SPEC "-m m68kelf %{shared} \
224 %{rdynamic:-export-dynamic} \
225 - %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \
226 + %{!dynamic-linker*:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
229 /* For compatibility with linux/a.out */
230 --- a/gcc/config/mips/linux.h
231 +++ b/gcc/config/mips/linux.h
232 @@ -105,6 +105,11 @@ Boston, MA 02110-1301, USA. */
234 /* Borrowed from sparc/linux.h */
237 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
239 +#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
244 @@ -112,7 +117,7 @@ Boston, MA 02110-1301, USA. */
247 %{rdynamic:-export-dynamic} \
248 - %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
249 + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
252 #undef SUBTARGET_ASM_SPEC
253 --- a/gcc/config/pa/pa-linux.h
254 +++ b/gcc/config/pa/pa-linux.h
255 @@ -49,13 +49,18 @@ Boston, MA 02110-1301, USA. */
256 /* Define this for shared library support because it isn't in the main
260 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
262 +#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
269 %{rdynamic:-export-dynamic} \
270 - %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
271 + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
274 /* glibc's profiling functions don't need gcc to allocate counters. */
275 --- a/gcc/config/rs6000/linux.h
276 +++ b/gcc/config/rs6000/linux.h
278 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
280 #undef LINK_OS_DEFAULT_SPEC
282 +#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)"
284 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
287 #define LINK_GCC_C_SEQUENCE_SPEC \
288 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
289 --- a/gcc/config/rs6000/sysv4.h
290 +++ b/gcc/config/rs6000/sysv4.h
291 @@ -866,6 +866,7 @@ extern int fixuplabelno;
292 mcall-linux : %(link_os_linux) ; \
293 mcall-gnu : %(link_os_gnu) ; \
294 mcall-netbsd : %(link_os_netbsd) ; \
295 + mcall-linux-uclibc : %(link_os_linux_uclibc); \
296 mcall-openbsd: %(link_os_openbsd) ; \
297 : %(link_os_default) }"
299 @@ -1043,6 +1044,10 @@ extern int fixuplabelno;
300 %{rdynamic:-export-dynamic} \
301 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
303 +#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \
304 + %{rdynamic:-export-dynamic} \
305 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}"
307 #if defined(HAVE_LD_EH_FRAME_HDR)
308 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
310 @@ -1209,6 +1214,7 @@ ncrtn.o%s"
311 { "link_os_sim", LINK_OS_SIM_SPEC }, \
312 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
313 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
314 + { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \
315 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
316 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
317 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
318 --- a/gcc/config/s390/linux.h
319 +++ b/gcc/config/s390/linux.h
320 @@ -77,6 +77,13 @@ Software Foundation, 51 Franklin Street,
321 #define MULTILIB_DEFAULTS { "m31" }
325 +#define ELF31_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
326 +#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
328 +#define ELF31_DYNAMIC_LINKER "/lib/ld.so.1"
329 +#define ELF64_DYNAMIC_LINKER "/lib/ld64.so.1"
333 "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
334 @@ -86,8 +93,8 @@ Software Foundation, 51 Franklin Street,
336 %{rdynamic:-export-dynamic} \
338 - %{m31:-dynamic-linker /lib/ld.so.1} \
339 - %{m64:-dynamic-linker /lib/ld64.so.1}}}}"
340 + %{m31:-dynamic-linker " ELF31_DYNAMIC_LINKER "} \
341 + %{m64:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}}}"
343 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
345 --- a/gcc/config/sh/linux.h
346 +++ b/gcc/config/sh/linux.h
347 @@ -56,12 +56,21 @@ Boston, MA 02110-1301, USA. */
348 #undef SUBTARGET_LINK_EMUL_SUFFIX
349 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
350 #undef SUBTARGET_LINK_SPEC
352 +#define SUBTARGET_LINK_SPEC \
353 + "%{shared:-shared} \
355 + %{rdynamic:-export-dynamic} \
356 + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
359 #define SUBTARGET_LINK_SPEC \
362 %{rdynamic:-export-dynamic} \
363 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
367 /* Output assembler code to STREAM to call the profiler. */
369 --- a/gcc/config/sparc/linux.h
370 +++ b/gcc/config/sparc/linux.h
371 @@ -125,6 +125,11 @@ Boston, MA 02110-1301, USA. */
373 /* If ELF is the default format, we should not use /lib/elf. */
376 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
378 +#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
381 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
382 %{!mno-relax:%{!r:-relax}} \
383 @@ -132,7 +137,7 @@ Boston, MA 02110-1301, USA. */
386 %{rdynamic:-export-dynamic} \
387 - %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
388 + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
391 /* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
392 --- a/gcc/config/sparc/linux64.h
393 +++ b/gcc/config/sparc/linux64.h
394 @@ -162,12 +162,17 @@ Boston, MA 02110-1301, USA. */
395 { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
396 { "link_arch", LINK_ARCH_SPEC },
399 +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
401 +#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
403 #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
407 %{rdynamic:-export-dynamic} \
408 - %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
409 + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
410 %{static:-static}}} \
413 --- a/libffi/configure
414 +++ b/libffi/configure
415 @@ -3457,6 +3457,11 @@ linux-gnu*)
416 lt_cv_deplibs_check_method=pass_all
420 + lt_cv_deplibs_check_method=pass_all
421 + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
424 netbsd* | knetbsd*-gnu)
425 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
426 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
427 --- a/libgfortran/configure
428 +++ b/libgfortran/configure
429 @@ -3699,6 +3699,11 @@ linux-gnu*)
430 lt_cv_deplibs_check_method=pass_all
434 + lt_cv_deplibs_check_method=pass_all
435 + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
438 netbsd* | knetbsd*-gnu)
439 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
440 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
441 --- a/libjava/configure
442 +++ b/libjava/configure
443 @@ -5137,6 +5137,11 @@ linux-gnu*)
444 lt_cv_deplibs_check_method=pass_all
448 + lt_cv_deplibs_check_method=pass_all
449 + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
452 netbsd* | knetbsd*-gnu)
453 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
454 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
455 --- a/libmudflap/configure
456 +++ b/libmudflap/configure
457 @@ -5382,6 +5382,11 @@ linux-gnu*)
458 lt_cv_deplibs_check_method=pass_all
462 + lt_cv_deplibs_check_method=pass_all
463 + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
466 netbsd* | knetbsd*-gnu)
467 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
468 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
469 --- a/libobjc/configure
470 +++ b/libobjc/configure
471 @@ -3312,6 +3312,11 @@ linux-gnu*)
472 lt_cv_deplibs_check_method=pass_all
476 + lt_cv_deplibs_check_method=pass_all
477 + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
480 netbsd* | knetbsd*-gnu)
481 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
482 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
485 @@ -743,6 +743,11 @@ linux-gnu*)
486 lt_cv_deplibs_check_method=pass_all
490 + lt_cv_deplibs_check_method=pass_all
491 + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
494 netbsd* | knetbsd*-gnu)
495 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
496 [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
499 @@ -603,6 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
501 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
505 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
507 @@ -1274,6 +1275,23 @@ linux-gnu*)
508 dynamic_linker='GNU/Linux ld.so'
515 + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
516 + soname_spec='${libname}${release}.so$major'
517 + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
518 + shlibpath_var=LD_LIBRARY_PATH
519 + shlibpath_overrides_runpath=no
520 + # This implies no fast_install, which is unacceptable.
521 + # Some rework will be needed to allow for fast_install
522 + # before this can be enabled.
523 + hardcode_into_libs=yes
524 + # Assume using the uClibc dynamic linker.
525 + dynamic_linker="uClibc ld.so"
533 @@ -3426,6 +3426,11 @@ linux-gnu*)
534 lt_cv_deplibs_check_method=pass_all
538 + lt_cv_deplibs_check_method=pass_all
539 + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
542 netbsd* | knetbsd*-gnu)
543 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
544 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'