kumquat-buildroot/sources/gcc2.95-uclibc-conf.patch
Manuel Novoa III 9168e83809 Enable building <arch>-linux-uclibc toolchains. Note that, due to config
issues for applications, we also create staging_dir/bin/<arch>-linux-*
symlinks which allows us to configure most apps with target=<arch>-linux.

gcc 3.3.2 libstdc++ now correctly identifies uclibc locale support.
There are still some issues (mainly related to wide char time strings
and wcsftime) to be addressed, but those are on hold until the uClibc
locale internals are reworked once again.

With the new stuff, we can also build gcc 2.95 and STLport again, although
the native gcc build for the target is failing.

Archs supported (some archs not yet tested):
 2.95 - i386, arm, mips*, powerpc.
 3.3.2 - Hopefull all for which uClibc has shared lib support.
2004-01-14 10:03:44 +00:00

292 lines
9.4 KiB
Diff

Warning! The powerpc patch (rs6000/linux.h) is hack-ish and would
definitely need to be improved to be acceptable upstream. Also,
this patch isn't complete as it only supports i386, arm, mips, and
powerpc (rs6000).
diff -urN gcc-20011006/config.sub gcc-20011006-new/config.sub
--- gcc-20011006/config.sub 2004-01-13 06:15:28.000000000 -0600
+++ gcc-20011006-new/config.sub 2004-01-10 11:09:35.000000000 -0600
@@ -68,7 +68,7 @@
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
- linux-gnu*)
+ linux-gnu* | linux-uclibc*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@@ -936,7 +936,8 @@
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -mingw32* | -linux-gnu* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* )
# Remember, each alternative MUST END IN *, to match a version number.
;;
diff -urN gcc-20011006/gcc/config/arm/linux-elf.h gcc-20011006-new/gcc/config/arm/linux-elf.h
--- gcc-20011006/gcc/config/arm/linux-elf.h 2004-01-13 06:15:28.000000000 -0600
+++ gcc-20011006-new/gcc/config/arm/linux-elf.h 2004-01-10 11:12:11.000000000 -0600
@@ -90,6 +90,18 @@
#define ENDFILE_SPEC \
"%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+#ifdef USE_UCLIBC
+#define LINK_SPEC "%{h*} %{version:-v} \
+ %{b} %{Wl,*:%*} \
+ %{static:-Bstatic} \
+ %{shared:-shared} \
+ %{symbolic:-Bsymbolic} \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} \
+ -X \
+ %{mbig-endian:-EB}" \
+ SUBTARGET_EXTRA_LINK_SPEC
+#else
#define LINK_SPEC "%{h*} %{version:-v} \
%{b} %{Wl,*:%*} \
%{static:-Bstatic} \
@@ -100,6 +112,7 @@
-X \
%{mbig-endian:-EB}" \
SUBTARGET_EXTRA_LINK_SPEC
+#endif
#undef CPP_PREDEFINES
#define CPP_PREDEFINES \
diff -urN gcc-20011006/gcc/config/i386/linux.h gcc-20011006-new/gcc/config/i386/linux.h
--- gcc-20011006/gcc/config/i386/linux.h 2001-04-03 17:38:59.000000000 -0500
+++ gcc-20011006-new/gcc/config/i386/linux.h 2004-01-10 11:15:38.000000000 -0600
@@ -199,6 +199,15 @@
%{static:-static}}}"
#endif
#else
+#if defined USE_UCLIBC
+#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
+ %{!shared: \
+ %{!ibcs: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
+ %{static:-static}}}"
+#else
#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
%{!shared: \
%{!ibcs: \
@@ -207,6 +216,7 @@
%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
%{static:-static}}}"
#endif
+#endif
/* Get perform_* macros to build libgcc.a. */
#include "i386/perform.h"
diff -urN gcc-20011006/gcc/config/mips/linux.h gcc-20011006-new/gcc/config/mips/linux.h
--- gcc-20011006/gcc/config/mips/linux.h 2004-01-13 06:15:28.000000000 -0600
+++ gcc-20011006-new/gcc/config/mips/linux.h 2004-01-10 11:16:39.000000000 -0600
@@ -154,6 +154,17 @@
/* Borrowed from sparc/linux.h */
#undef LINK_SPEC
+#ifdef USE_UCLIBC
+#define LINK_SPEC \
+ "%(endian_spec) \
+ %{shared:-shared} \
+ %{!shared: \
+ %{!ibcs: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
+ %{static:-static}}}"
+#else
#define LINK_SPEC \
"%(endian_spec) \
%{shared:-shared} \
@@ -163,6 +174,7 @@
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
%{static:-static}}}"
+#endif
#undef SUBTARGET_ASM_SPEC
diff -urN old/gcc-20011006/gcc/config/mips/t-linux-uclibc gcc-20011006/gcc/config/mips/t-linux-uclibc
--- old/gcc-20011006/gcc/config/mips/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
+++ gcc-20011006/gcc/config/mips/t-linux-uclibc 2004-01-14 02:51:10.000000000 -0600
@@ -0,0 +1 @@
+T_CFLAGS = -DUSE_UCLIBC
diff -urN gcc-20011006/gcc/config/rs6000/linux.h gcc-20011006-new/gcc/config/rs6000/linux.h
--- gcc-20011006/gcc/config/rs6000/linux.h 2001-04-03 17:38:59.000000000 -0500
+++ gcc-20011006-new/gcc/config/rs6000/linux.h 2004-01-10 11:15:38.000000000 -0600
@@ -36,12 +36,21 @@
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
#undef LINK_SPEC
+#ifdef USE_UCLIBC
+#define LINK_SPEC "-m elf32ppclinux %{G*} %{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
+ %{static:-static}}"
+#else
#define LINK_SPEC "-m elf32ppclinux %{G*} %{shared:-shared} \
%{!shared: \
%{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
%{static:-static}}"
+#endif
#undef LIB_DEFAULT_SPEC
#define LIB_DEFAULT_SPEC "%(lib_linux)"
diff -urN gcc-20011006/gcc/config/t-linux-uclibc gcc-20011006-new/gcc/config/t-linux-uclibc
--- gcc-20011006/gcc/config/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
+++ gcc-20011006-new/gcc/config/t-linux-uclibc 2004-01-10 11:18:46.000000000 -0600
@@ -0,0 +1,18 @@
+T_CFLAGS = -DUSE_UCLIBC
+
+# Don't run fixproto
+STMP_FIXPROTO =
+
+# Don't install "assert.h" in gcc. We use the one in glibc.
+INSTALL_ASSERT_H =
+
+# Compile crtbeginS.o and crtendS.o with pic.
+CRTSTUFF_T_CFLAGS_S = -fPIC
+# Compile libgcc2.a with pic.
+TARGET_LIBGCC2_CFLAGS = -fPIC
+
+# Do not build libgcc1. Let gcc generate those functions. The GNU/Linux
+# C library can handle them.
+LIBGCC1 =
+CROSS_LIBGCC1 =
+LIBGCC1_TEST =
diff -urN gcc-20011006/gcc/configure gcc-20011006-new/gcc/configure
--- gcc-20011006/gcc/configure 2004-01-13 06:15:28.000000000 -0600
+++ gcc-20011006-new/gcc/configure 2004-01-10 11:28:54.000000000 -0600
@@ -3219,6 +3219,24 @@
;;
esac
;;
+ arm*-*-linux-uclibc*) # ARM GNU/Linux with ELF - uClibc
+ xm_file=arm/xm-linux.h
+ xmake_file=x-linux
+ tm_file="arm/linux-elf.h"
+ case $machine in
+ armv2*-*-*)
+ tm_file="arm/linux-elf26.h $tm_file"
+ ;;
+ esac
+ tmake_file="t-linux arm/t-linux"
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ gnu_ld=yes
+ case x${enable_threads} in
+ x | xyes | xpthreads | xposix)
+ thread_file='posix'
+ ;;
+ esac
+ ;;
arm*-*-aout)
tm_file=arm/aout.h
tmake_file=arm/t-bare
@@ -3631,6 +3649,18 @@
thread_file='single'
fi
;;
+ i[34567]86-*-linux*uclibc*) # Intel 80386's running GNU/Linux
+ # with ELF format using uClibc
+ xmake_file=x-linux
+ tm_file=i386/linux.h
+ tmake_file="t-linux-uclibc i386/t-crtstuff"
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ gnu_ld=yes
+ float_format=i386
+ if test x$enable_threads = xyes; then
+ thread_file='posix'
+ fi
+ ;;
i[34567]86-*-linux-gnu*) # Intel 80386's running GNU/Linux
# aka GNU/Linux C library 6
xmake_file=x-linux
@@ -4696,7 +4726,19 @@
# On NetBSD, the headers are already okay, except for math.h.
tmake_file=t-netbsd
;;
- mips*-*-linux*) # Linux MIPS, either endian.
+ mips*-*-linux-uclibc*) # Linux (uclibc) MIPS, either endian.
+ tmake_file=mips/t-linux-uclibc
+ xmake_file=x-linux
+ xm_file="xm-siglist.h ${xm_file}"
+ case $machine in
+ mipsel-*) tm_file="mips/elfl.h mips/linux.h" ;;
+ *) tm_file="mips/elf.h mips/linux.h" ;;
+ esac
+ extra_parts="crtbegin.o crtend.o"
+ gnu_ld=yes
+ gas=yes
+ ;;
+ mips*-*-linux*) # Linux MIPS, either endian.
xmake_file=x-linux
xm_file="xm-siglist.h ${xm_file}"
case $machine in
@@ -5159,6 +5201,24 @@
thread_file='posix'
fi
;;
+ powerpc-*-linux-uclibc*)
+ tm_file=rs6000/linux.h
+ xm_file="xm-siglist.h rs6000/xm-sysv4.h"
+ xm_defines="USG ${xm_defines}"
+ out_file=rs6000/rs6000.c
+ if test x$gas = xyes
+ then
+ tmake_file="rs6000/t-ppcos t-linux-uclibc rs6000/t-ppccomm"
+ else
+ tmake_file="rs6000/t-ppc t-linux-uclibc rs6000/t-ppccomm"
+ fi
+ xmake_file=x-linux
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ extra_headers=ppc-asm.h
+ if test x$enable_threads = xyes; then
+ thread_file='posix'
+ fi
+ ;;
powerpc-wrs-vxworks*)
cpu_type=rs6000
xm_file="xm-siglist.h rs6000/xm-sysv4.h"
diff -urN gcc-20011006/ltconfig gcc-20011006-new/ltconfig
--- gcc-20011006/ltconfig 1999-06-21 21:35:12.000000000 -0500
+++ gcc-20011006-new/ltconfig 2004-01-10 11:34:23.000000000 -0600
@@ -436,6 +436,7 @@
# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
case "$host_os" in
linux-gnu*) ;;
+linux-uclibc*) ;;
linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac
@@ -1773,6 +1774,22 @@
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