diff options
Diffstat (limited to 'toolchain')
23 files changed, 649 insertions, 1076 deletions
diff --git a/toolchain/Config.in b/toolchain/Config.in index 7ceb7942eb..5b3fe70125 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -38,7 +38,7 @@ config BR2_SOFT_FLOAT config BR2_TARGET_OPTIMIZATION string "Target Optimizations" - default "-Os -pipe -mips2" + default "-Os -pipe -mips32 -mtune=mips32" help Optimizations to use when building for the target host. diff --git a/toolchain/Makefile b/toolchain/Makefile new file mode 100644 index 0000000000..0c06fe9ea0 --- /dev/null +++ b/toolchain/Makefile @@ -0,0 +1,45 @@ +# Main makefile for the toolchain +include $(TOPDIR)/rules.mk +TARGETS:=sed utils binutils gcc uClibc ipkg-utils + +TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS)) +TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) + +all: install +install: $(TARGETS_INSTALL) +clean: $(TARGETS_CLEAN) + +uClibc-prepare: kernel-headers-prepare sed-install utils-install +binutils-prepare: uClibc-prepare +gcc-prepare: binutils-install +uClibc-compile: gcc-prepare +gcc-install: uClibc-install + +$(STAMP_DIR): + mkdir -p $(STAMP_DIR) + +$(STAGING_DIR): + @mkdir -p $(STAGING_DIR)/lib + @mkdir -p $(STAGING_DIR)/include + @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) + @ln -sf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib + +$(TOOL_BUILD_DIR): + @mkdir -p $(TOOL_BUILD_DIR) + +%-prepare: $(STAMP_DIR) $(STAGING_DIR) $(TOOL_BUILD_DIR) + @[ -f $(STAMP_DIR)/.toolchain_$@ ] || $(MAKE) -C $(patsubst %-prepare,%,$@) prepare + @touch $(STAMP_DIR)/.toolchain_$@ + +%-compile: %-prepare + @[ -f $(STAMP_DIR)/.toolchain_$@ ] || $(MAKE) -C $(patsubst %-compile,%,$@) compile + @touch $(STAMP_DIR)/.toolchain_$@ + +%-install: %-compile + @[ -f $(STAMP_DIR)/.toolchain_$@ ] || $(MAKE) -C $(patsubst %-install,%,$@) install + @touch $(STAMP_DIR)/.toolchain_$@ + +%-clean: + @$(MAKE) -C $(patsubst %-clean,%,$@) clean + @rm -f $(STAMP_DIR)/.toolchain_$(patsubst %-clean,%,$@)-* + diff --git a/toolchain/Makefile.in b/toolchain/Makefile.in deleted file mode 100644 index bc2d26dfb2..0000000000 --- a/toolchain/Makefile.in +++ /dev/null @@ -1,10 +0,0 @@ -ifeq ($(BR2_ENABLE_MULTILIB),y) -MULTILIB:=--enable-multilib -endif - - -# FIXME -- this is temporary -OPTIMIZE_FOR_CPU=$(ARCH) - -# gcc has a bunch of needed stuff.... -include toolchain/gcc/Makefile.in diff --git a/toolchain/binutils/2.14.90.0.6/002-max-pagesize.patch b/toolchain/binutils/2.14.90.0.6/002-max-pagesize.patch new file mode 100644 index 0000000000..a8ae110e86 --- /dev/null +++ b/toolchain/binutils/2.14.90.0.6/002-max-pagesize.patch @@ -0,0 +1,12 @@ +diff -urN binutils-2.14.90.0.8.test/bfd/elf32-mips.c binutils-2.14.90.0.8/bfd/elf32-mips.c +--- binutils-2.14.90.0.8.test/bfd/elf32-mips.c 2004-01-14 22:07:43.000000000 +0100 ++++ binutils-2.14.90.0.8/bfd/elf32-mips.c 2005-03-03 23:44:00.000000000 +0100 +@@ -1611,7 +1611,7 @@ + + /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses + page sizes of up to that limit, so we need to respect it. */ +-#define ELF_MAXPAGESIZE 0x10000 ++#define ELF_MAXPAGESIZE 0x1000 + #define elf32_bed elf32_tradbed + + /* Include the target file again for this target. */ diff --git a/toolchain/binutils/2.14.90.0.7/002-max-pagesize.patch b/toolchain/binutils/2.14.90.0.7/002-max-pagesize.patch new file mode 100644 index 0000000000..a8ae110e86 --- /dev/null +++ b/toolchain/binutils/2.14.90.0.7/002-max-pagesize.patch @@ -0,0 +1,12 @@ +diff -urN binutils-2.14.90.0.8.test/bfd/elf32-mips.c binutils-2.14.90.0.8/bfd/elf32-mips.c +--- binutils-2.14.90.0.8.test/bfd/elf32-mips.c 2004-01-14 22:07:43.000000000 +0100 ++++ binutils-2.14.90.0.8/bfd/elf32-mips.c 2005-03-03 23:44:00.000000000 +0100 +@@ -1611,7 +1611,7 @@ + + /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses + page sizes of up to that limit, so we need to respect it. */ +-#define ELF_MAXPAGESIZE 0x10000 ++#define ELF_MAXPAGESIZE 0x1000 + #define elf32_bed elf32_tradbed + + /* Include the target file again for this target. */ diff --git a/toolchain/binutils/2.15/002-max-pagesize.patch b/toolchain/binutils/2.15/002-max-pagesize.patch new file mode 100644 index 0000000000..a8ae110e86 --- /dev/null +++ b/toolchain/binutils/2.15/002-max-pagesize.patch @@ -0,0 +1,12 @@ +diff -urN binutils-2.14.90.0.8.test/bfd/elf32-mips.c binutils-2.14.90.0.8/bfd/elf32-mips.c +--- binutils-2.14.90.0.8.test/bfd/elf32-mips.c 2004-01-14 22:07:43.000000000 +0100 ++++ binutils-2.14.90.0.8/bfd/elf32-mips.c 2005-03-03 23:44:00.000000000 +0100 +@@ -1611,7 +1611,7 @@ + + /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses + page sizes of up to that limit, so we need to respect it. */ +-#define ELF_MAXPAGESIZE 0x10000 ++#define ELF_MAXPAGESIZE 0x1000 + #define elf32_bed elf32_tradbed + + /* Include the target file again for this target. */ diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile new file mode 100644 index 0000000000..2bbb48727b --- /dev/null +++ b/toolchain/binutils/Makefile @@ -0,0 +1,9 @@ +include $(TOPDIR)/rules.mk + +include ./binutils.mk + +source: binutils-source +prepare: $(BINUTILS_DIR)/.patched +compile: $(BINUTILS_DIR1)/binutils/objdump +install: binutils +clean: binutils-distclean binutils-toolclean diff --git a/toolchain/binutils/Makefile.in b/toolchain/binutils/Makefile.in deleted file mode 100644 index c6838bb053..0000000000 --- a/toolchain/binutils/Makefile.in +++ /dev/null @@ -1 +0,0 @@ -BINUTILS_VERSION:=$(strip $(subst ",, $(BR2_BINUTILS_VERSION))) diff --git a/toolchain/binutils/binutils.mk b/toolchain/binutils/binutils.mk index 3097a4bf21..c0d504d6dc 100644 --- a/toolchain/binutils/binutils.mk +++ b/toolchain/binutils/binutils.mk @@ -33,7 +33,7 @@ $(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE) $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked # Apply appropriate binutils patches. - toolchain/patch-kernel.sh $(BINUTILS_DIR) toolchain/binutils/$(BINUTILS_VERSION) \*.patch + $(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./$(BINUTILS_VERSION) \*.patch touch $(BINUTILS_DIR)/.patched $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched @@ -54,10 +54,10 @@ $(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured # Make install will put gettext data in staging_dir/share/locale. # Unfortunatey, it isn't configureable. -$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/ld: $(BINUTILS_DIR1)/binutils/objdump +$(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld: $(BINUTILS_DIR1)/binutils/objdump $(MAKE) -C $(BINUTILS_DIR1) install -binutils-dependancies: +binutils-dependencies: @if ! which bison > /dev/null ; then \ echo -e "\n\nYou must install 'bison' on your build machine\n"; \ exit 1; \ @@ -71,7 +71,7 @@ binutils-dependancies: exit 1; \ fi; -binutils: binutils-dependancies $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/ld +binutils: binutils-dependencies $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld binutils-source: $(DL_DIR)/$(BINUTILS_SOURCE) @@ -82,6 +82,8 @@ binutils-clean: binutils-toolclean: rm -rf $(BINUTILS_DIR1) +binutils-distclean: + rm -rf $(BINUTILS_DIR) ############################################################# diff --git a/toolchain/gcc/2.95/050-debian-subset.patch.bz2 b/toolchain/gcc/2.95/050-debian-subset.patch.bz2 Binary files differdeleted file mode 100644 index 6c2d518273..0000000000 --- a/toolchain/gcc/2.95/050-debian-subset.patch.bz2 +++ /dev/null diff --git a/toolchain/gcc/2.95/100-uclibc-conf.patch b/toolchain/gcc/2.95/100-uclibc-conf.patch deleted file mode 100644 index f244387cc9..0000000000 --- a/toolchain/gcc/2.95/100-uclibc-conf.patch +++ /dev/null @@ -1,291 +0,0 @@ -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-uclibc 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 diff --git a/toolchain/gcc/2.95/STLport-4.5.3.patch b/toolchain/gcc/2.95/STLport-4.5.3.patch deleted file mode 100644 index fee65f9200..0000000000 --- a/toolchain/gcc/2.95/STLport-4.5.3.patch +++ /dev/null @@ -1,407 +0,0 @@ -diff -urN STLport-4.5.3/Makefile STLport-4.5.3-devel/Makefile ---- STLport-4.5.3/Makefile Wed Dec 31 17:00:00 1969 -+++ STLport-4.5.3-devel/Makefile Tue Jan 7 15:28:08 2003 -@@ -0,0 +1,44 @@ -+# Makefile to compile stlport with uClibc -+# -+# Copyright (C) 2002 Erik Andersen <andersen@codepoet.org> -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ -+ARCH:=i386 -+PREFIX:=/usr/$(ARCH)-linux-uclibc -+CROSS:= $(PREFIX)/../bin/$(ARCH)-linux-uclibc- -+CC=$(CROSS)gcc -+CXX=$(CROSS)g++ -+AR = $(CROSS)ar -+STRIP = $(CROSS)strip --remove-section=.comment --remove-section=.note --strip-unneeded -+.EXPORT_ALL_VARIABLES: -+ -+all: -+ rm -f lib/lib* -+ make -C src -f gcc-uClibc.mak all -+ (cd lib; rm -f libstdc++_debug.so; \ -+ ln -fs libstdc++.so.4.5 libstdc++.so; \ -+ ln -fs libstdc++.so.4.5 libstdc++.so.0;) -+ $(STRIP) lib/libstdc++.so.4.5; -+ -+clean: -+ make -C src -f gcc-uClibc.mak clean -+ rm -rf lib/* -+ -+install: -+ (cd lib; \ -+ cp -a libstdc++.a $(PREFIX)/lib; \ -+ cp -a libstdc++.so libstdc++.so.0 libstdc++.so.4.5 $(PREFIX)/lib;) -+ cp -a stlport $(PREFIX)/include/c++ -diff -urN STLport-4.5.3/src/dll_main.cpp STLport-4.5.3-devel/src/dll_main.cpp ---- STLport-4.5.3/src/dll_main.cpp Sat Feb 2 16:11:56 2002 -+++ STLport-4.5.3-devel/src/dll_main.cpp Tue Jan 7 15:28:08 2003 -@@ -52,7 +52,7 @@ - # include <locale> - # endif - --# if defined (_STLP_UNIX) -+# if defined (_STLP_UNIX) && defined (_STLP_PTHREADS) && ! defined (_STLP_USE_UCLIBC) - # define _STLP_HAS_PERTHREAD_ALLOCATOR - # include <stl/_pthread_alloc.h> - # endif -diff -urN STLport-4.5.3/src/gcc-uClibc.mak STLport-4.5.3-devel/src/gcc-uClibc.mak ---- STLport-4.5.3/src/gcc-uClibc.mak Wed Dec 31 17:00:00 1969 -+++ STLport-4.5.3-devel/src/gcc-uClibc.mak Tue Jan 7 15:28:08 2003 -@@ -0,0 +1,61 @@ -+# -+# Basename for libraries -+# -+LIB_BASENAME:=libstdc++ -+LIB_SHAREDNAME:=$(LIB_BASENAME).so -+LIB_SHAREDNAME_FULL:=$(LIB_SHAREDNAME).0 -+ -+# -+# guts for common stuff -+# -+# -+LINK:=$(AR) -cr -+#DYN_LINK:=$(CC) -fno-exceptions -lpthread -lm -shared -Wl,-soname=$(LIB_SHAREDNAME_FULL) -o -+DYN_LINK:=$(CC) -fno-exceptions -shared -Wl,-soname=$(LIB_SHAREDNAME_FULL) -o -+ -+OBJEXT=o -+DYNEXT=so -+STEXT=a -+RM=rm -rf -+PATH_SEP=/ -+MKDIR=mkdir -p -+COMP=GCC$(ARCH) -+INSTALL_STEP = install_unix -+ -+all: release_dynamic release_static -+#all: all_dynamic all_static symbolic_links -+ -+include common_macros.mak -+STLDEBUG_NAME:=$(LIB_BASENAME).debug -+ -+# Lets disable exception support, since this saves over 200k... -+DEFINE_FLAGS:= -fno-exceptions -+#DEFINE_FLAGS:= -D_STLP_NO_EXCEPTIONS -fno-exceptions -DSTL_NO_EXCEPTIONS -+ -+#DEFINE_FLAGS+= -D_STLP_USE_UCLIBC -D_STLP_NO_WCHAR_T \ -+# -DUSE_SPRINTF_INSTEAD -D_ISOC99_SOURCE -+ -+WARNING_FLAGS:= -W -Wno-sign-compare -Wno-unused -Wno-uninitialized -+INCLUDE_FLAGS = -I${STLPORT_DIR} -+CXXFLAGS_COMMON = $(WARNING_FLAGS) $(DEFINE_FLAGS) $(INCLUDE_FLAGS) -+ -+CXXFLAGS_RELEASE_static = $(CXXFLAGS_COMMON) -Os -+CXXFLAGS_RELEASE_dynamic = $(CXXFLAGS_COMMON) -Os -fPIC -+ -+CXXFLAGS_DEBUG_static = $(CXXFLAGS_COMMON) -O -g -+CXXFLAGS_DEBUG_dynamic = $(CXXFLAGS_COMMON) -O -g -fPIC -+ -+CXXFLAGS_STLDEBUG_static = $(CXXFLAGS_DEBUG_static) -D_STLP_DEBUG -+CXXFLAGS_STLDEBUG_dynamic = $(CXXFLAGS_DEBUG_dynamic) -D_STLP_DEBUG -fPIC -+ -+include common_percent_rules.mak -+include common_rules.mak -+ -+ -+#install: all -+# cp -p $(LIB_TARGET) ${D_LIB_TARGET} ../lib -+ -+#%.s: %.cpp -+# $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ -+ -+ -diff -urN STLport-4.5.3/src/num_put_float.cpp STLport-4.5.3-devel/src/num_put_float.cpp ---- STLport-4.5.3/src/num_put_float.cpp Fri Jan 18 15:06:52 2002 -+++ STLport-4.5.3-devel/src/num_put_float.cpp Tue Jan 7 15:28:08 2003 -@@ -65,6 +65,12 @@ - - # endif - -+# if defined(_STLP_USE_UCLIBC) -+# define __USE_ISOC99 1 -+# include <math.h> -+# include <float.h> -+# endif -+ - # include <cstdlib> - - #if defined (_MSC_VER) || defined (__MINGW32__) || defined (__BORLANDC__) || defined (__DJGPP) || defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR) -@@ -209,7 +215,7 @@ - - #ifdef USE_SPRINTF_INSTEAD - --#elif defined (__hpux) || defined (__DJGPP) || ( defined(_STLP_USE_GLIBC) && ! defined (__MSL__) ) -+#elif defined (__hpux) || defined (__DJGPP) || ( defined(_STLP_USE_GLIBC) && ! defined (__MSL__) ) || defined (_STLP_USE_UCLIBC) - # if defined (isfinite) - inline bool _Stl_is_nan_or_inf(double x) { return !isfinite(x); } - # else -@@ -238,7 +244,7 @@ - } - inline bool _Stl_is_neg_inf(double x) { return _fpclass(x) == _FPCLASS_NINF; } - inline bool _Stl_is_neg_nan(double x) { return _isnan(x) && _copysign(1., x) < 0 ; } --#elif defined(__MRC__) || defined(__SC__) //*TY 02/24/2000 - added support for MPW -+#elif defined(__MRC__) || defined(__SC__) - bool _Stl_is_nan_or_inf(double x) { return isnan(x) || !isfinite(x); } - bool _Stl_is_inf(double x) { return !isfinite(x); } - bool _Stl_is_neg_inf(double x) { return !isfinite(x) && signbit(x); } -@@ -280,7 +286,7 @@ - inline char* _Stl_qfcvtR(long double x, int n, int* pt, int* sign, char* buf) - { return fcvtbuf(x, n, pt, sign, buf); } - # endif --#elif defined (_STLP_USE_GLIBC) -+#elif defined (_STLP_USE_GLIBC) || defined(_STLP_USE_UCLIBC) - inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf) - { return buf + ecvt_r(x, n, pt, sign, buf, NDIG+2); } - inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf) -diff -urN STLport-4.5.3/src/stdio_streambuf.cpp STLport-4.5.3-devel/src/stdio_streambuf.cpp ---- STLport-4.5.3/src/stdio_streambuf.cpp Thu Jan 10 11:41:52 2002 -+++ STLport-4.5.3-devel/src/stdio_streambuf.cpp Tue Jan 7 15:28:08 2003 -@@ -82,7 +82,7 @@ - _STLP_VENDOR_CSTD::fgetpos(_M_file, &pos); - // added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead - // of a primitive type --#if (defined(__GLIBC__) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) ) -+#if defined(_STLP_USE_UCLIBC) || (defined(__GLIBC__) && defined(_STLP_USE_GLIBC) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) ) - return pos_type((streamoff)pos.__pos); - #elif defined(__ISCPP__) || defined(__MVS__) || (__OS400__) - return pos_type(pos.__fpos_elem[ 0 ]); -@@ -101,13 +101,16 @@ - - // added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead - // of a primitive type --#if (defined(__GLIBC__) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) ) -+#if (defined(__GLIBC__) && defined(_STLP_USE_GLIBC) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) ) - fpos_t p; - p.__pos = pos; - memset( &(p.__state), 0, sizeof(p.__state) ); - #elif defined(__MVS__) || (__OS400__) - fpos_t p; - p.__fpos_elem[0] = pos; -+#elif defined(_STLP_USE_UCLIBC) -+ fpos_t p; -+ p.__pos = pos; - #else - fpos_t p(pos); - #endif -diff -urN STLport-4.5.3/stlport/config/_prolog.h STLport-4.5.3-devel/stlport/config/_prolog.h ---- STLport-4.5.3/stlport/config/_prolog.h Sun Oct 28 13:26:44 2001 -+++ STLport-4.5.3-devel/stlport/config/_prolog.h Tue Jan 7 15:28:08 2003 -@@ -1,3 +1,8 @@ -+/* Evil hack to make sure everything behaves itself */ -+#define _STLP_USE_UCLIBC -+//#define _STLP_NO_WCHAR_T -+//#define _ISOC99_SOURCE -+//#define USE_SPRINTF_INSTEAD - - #if defined (_STLP_MSVC) || defined (__ICL) || defined (__BORLANDC__) - -diff -urN STLport-4.5.3/stlport/config/stl_gcc.h STLport-4.5.3-devel/stlport/config/stl_gcc.h ---- STLport-4.5.3/stlport/config/stl_gcc.h Thu Jan 10 11:41:58 2002 -+++ STLport-4.5.3-devel/stlport/config/stl_gcc.h Tue Jan 7 15:28:08 2003 -@@ -3,7 +3,7 @@ - */ - - /* Systems having GLIBC installed have different traits */ --#if ! defined (_STLP_USE_GLIBC) && ( defined (__linux__) || defined (__CYGWIN__) ) -+#if ! defined (_STLP_USE_GLIBC) && ! defined (_STLP_USE_UCLIBC) && ( defined (__linux__) || defined (__CYGWIN__) ) - # define _STLP_USE_GLIBC - #endif - -diff -urN STLport-4.5.3/stlport/cstdlib STLport-4.5.3-devel/stlport/cstdlib ---- STLport-4.5.3/stlport/cstdlib Thu Aug 23 15:51:54 2001 -+++ STLport-4.5.3-devel/stlport/cstdlib Tue Jan 7 15:28:08 2003 -@@ -55,9 +55,11 @@ - using _STLP_VENDOR_CSTD::atof; - using _STLP_VENDOR_CSTD::atoi; - using _STLP_VENDOR_CSTD::atol; -+# ifndef _STLP_USE_UCLIBC - using _STLP_VENDOR_CSTD::mblen; - using _STLP_VENDOR_CSTD::mbstowcs; - using _STLP_VENDOR_CSTD::mbtowc; -+# endif - using _STLP_VENDOR_CSTD::strtod; - using _STLP_VENDOR_CSTD::strtol; - using _STLP_VENDOR_CSTD::strtoul; -diff -urN STLport-4.5.3/stlport/stl/_config.h STLport-4.5.3-devel/stlport/stl/_config.h ---- STLport-4.5.3/stlport/stl/_config.h Fri Jan 18 15:08:36 2002 -+++ STLport-4.5.3-devel/stlport/stl/_config.h Tue Jan 7 15:28:08 2003 -@@ -26,6 +26,16 @@ - #ifndef _STLP_CONFIG_H - # define _STLP_CONFIG_H - -+/* Make the STLport headers provide uClibc support by default */ -+#define _STLP_NO_EXCEPTIONS 1 -+#define STL_NO_EXCEPTIONS 1 -+#define _STLP_USE_UCLIBC 1 -+//#define _STLP_NO_WCHAR_T 1 -+#define _STLP_NO_LONG_DOUBLE 1 -+#define USE_SPRINTF_INSTEAD 1 -+#define _ISOC99_SOURCE 1 -+#define _STLP_NO_ANACHRONISMS 1 -+ - /* - * Purpose of this file : - * -@@ -164,7 +174,7 @@ - /* Operating system recognition (basic) */ - # if defined (__unix) || defined (__linux__) || defined (__QNX__) || defined (_AIX) || defined (__NetBSD__) || defined (__Lynx__) - # define _STLP_UNIX 1 --# if defined (__linux__) && ! defined (_STLP_USE_GLIBC) -+# if defined (__linux__) && ! defined (_STLP_USE_GLIBC) && ! defined (_STLP_USE_UCLIBC) - # define _STLP_USE_GLIBC 1 - # endif - # elif defined(macintosh) || defined (_MAC) -diff -urN STLport-4.5.3/stlport/stl/_stdio_file.h STLport-4.5.3-devel/stlport/stl/_stdio_file.h ---- STLport-4.5.3/stlport/stl/_stdio_file.h Fri Jan 18 15:07:00 2002 -+++ STLport-4.5.3-devel/stlport/stl/_stdio_file.h Tue Jan 7 15:28:08 2003 -@@ -634,6 +634,112 @@ - } - # define _STLP_FILE_I_O_IDENTICAL - -+#elif defined(_STLP_USE_UCLIBC) -+ -+#if defined(__MASK_READING) -+ -+inline int _FILE_fd(const FILE *__f) { return __f->__filedes; } -+ -+// Returns a pointer to the beginning of the buffer. -+inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->__bufstart; } -+ -+// Returns the current read/write position within the buffer. -+inline char* _FILE_I_next(const FILE *__f) { return (char*) __f->__bufpos; } -+ -+// Returns a pointer immediately past the end of the buffer. -+inline char* _FILE_I_end(const FILE *__f) { return (char*)__f->__bufend; } -+ -+// Returns the number of characters remaining in the buffer, i.e. -+// _FILE_[IO]_end(__f) - _FILE_[IO]_next(__f). -+inline ptrdiff_t _FILE_I_avail(const FILE *__f) -+ { return __f->__bufgetc_u - __f->__bufpos; } -+ -+// Increments the current read/write position by 1, returning the -+// character at the old position. -+inline char& _FILE_I_preincr(FILE *__f) { return *(char*)(++__f->__bufpos); } -+ -+// Increments the current read/write position by 1, returning the -+// character at the old position. -+inline char& _FILE_I_postincr(FILE *__f) { return *(char*)(__f->__bufpos++); } -+ -+// Decrements the current read/write position by 1, returning the -+// character at the old position. -+inline char& _FILE_I_predecr(FILE *__f) { return *(char*)(--__f->__bufpos); } -+ -+// Decrements the current read/write position by 1, returning the -+// character at the old position. -+inline char& _FILE_I_postdecr(FILE *__f) { return *(char*)(__f->__bufpos--); } -+ -+// Increments the current read/write position by __n. -+inline void _FILE_I_bump(FILE *__f, int __n) { __f->__bufpos += __n; } -+ -+// Sets the beginning of the bufer to __begin, the current read/write -+// position to __next, and the buffer's past-the-end pointer to __end. -+// If any of those pointers is null, then all of them must be null. -+inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) -+{ -+ __f->__bufstart = (unsigned char*)__begin; -+ __f->__bufpos = (unsigned char*)__next; -+ __f->__bufend = (unsigned char*)__end; -+ __f->__bufgetc_u = (unsigned char*)__begin; -+ __f->__bufputc_u = (unsigned char*)__end; -+} -+ -+# define _STLP_FILE_I_O_IDENTICAL -+ -+#else // Support old stdio for a little while. -+ -+inline int _FILE_fd(const FILE *__f) { return __f->filedes; } -+ -+// Returns a pointer to the beginning of the buffer. -+inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->bufstart; } -+ -+// Returns the current read/write position within the buffer. -+inline char* _FILE_I_next(const FILE *__f) { return (char*) __f->bufpos; } -+ -+// Returns a pointer immediately past the end of the buffer. -+inline char* _FILE_I_end(const FILE *__f) { return (char*)__f->bufend; } -+ -+// Returns the number of characters remaining in the buffer, i.e. -+// _FILE_[IO]_end(__f) - _FILE_[IO]_next(__f). -+inline ptrdiff_t _FILE_I_avail(const FILE *__f) -+ { return __f->bufgetc - __f->bufpos; } -+ -+// Increments the current read/write position by 1, returning the -+// character at the old position. -+inline char& _FILE_I_preincr(FILE *__f) { return *(char*)(++__f->bufpos); } -+ -+// Increments the current read/write position by 1, returning the -+// character at the old position. -+inline char& _FILE_I_postincr(FILE *__f) { return *(char*)(__f->bufpos++); } -+ -+// Decrements the current read/write position by 1, returning the -+// character at the old position. -+inline char& _FILE_I_predecr(FILE *__f) { return *(char*)(--__f->bufpos); } -+ -+// Decrements the current read/write position by 1, returning the -+// character at the old position. -+inline char& _FILE_I_postdecr(FILE *__f) { return *(char*)(__f->bufpos--); } -+ -+// Increments the current read/write position by __n. -+inline void _FILE_I_bump(FILE *__f, int __n) { __f->bufpos += __n; } -+ -+// Sets the beginning of the bufer to __begin, the current read/write -+// position to __next, and the buffer's past-the-end pointer to __end. -+// If any of those pointers is null, then all of them must be null. -+inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) -+{ -+ __f->bufstart = (unsigned char*)__begin; -+ __f->bufpos = (unsigned char*)__next; -+ __f->bufend = (unsigned char*)__end; -+ __f->bufgetc = (unsigned char*)__begin; -+ __f->bufputc = (unsigned char*)__end; -+} -+ -+# define _STLP_FILE_I_O_IDENTICAL -+ -+#endif -+ - #else /* A C library that we don't have an implementation for. */ - - # error The C++ I/O library is not configured for this compiler -diff -urN STLport-4.5.3/stlport/stl/c_locale.h STLport-4.5.3-devel/stlport/stl/c_locale.h ---- STLport-4.5.3/stlport/stl/c_locale.h Fri Jan 18 15:07:00 2002 -+++ STLport-4.5.3-devel/stlport/stl/c_locale.h Wed Jan 8 10:58:10 2003 -@@ -401,6 +401,21 @@ - # define _Locale_SPACE _S - # define _Locale_PRINT (_P | _U | _L | _N | _B) - # define _Locale_ALPHA (_U | _L) -+ -+# elif defined(_STLP_USE_UCLIBC) /* linux, using the gnu compiler */ -+ -+# define _Locale_CNTRL _IScntrl -+# define _Locale_UPPER _ISupper -+# define _Locale_LOWER _ISlower -+# define _Locale_DIGIT _ISdigit -+# define _Locale_XDIGIT _ISxdigit -+# define _Locale_PUNCT _ISpunct -+# define _Locale_SPACE _ISspace -+# define _Locale_PRINT _ISprint -+# define _Locale_ALPHA _ISalpha -+ -+#else -+# error Unknown Locale - #endif - - # endif /* _STLP_C_LOCALE_H */ diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in index c23cb39da6..2ad0b5e6b7 100644 --- a/toolchain/gcc/Config.in +++ b/toolchain/gcc/Config.in @@ -10,10 +10,6 @@ choice help Select the version of gcc you wish to use. - config BR2_GCC_VERSION_2_95 - bool "gcc 2.95" - depends on BR2_arm || BR2_i386 || BR2_mips || BR2_powerpc - config BR2_GCC_VERSION_3_3_3 bool "gcc 3.3.3" diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile new file mode 100644 index 0000000000..d060ab0b6c --- /dev/null +++ b/toolchain/gcc/Makefile @@ -0,0 +1,9 @@ +include $(TOPDIR)/rules.mk + +include ./gcc-uclibc-3.x.mk + +source: gcc-source +prepare: gcc_initial +compile: $(GCC_BUILD_DIR2)/.compiled +install: gcc-install +clean: gcc_initial-clean gcc-clean diff --git a/toolchain/gcc/gcc-uclibc-2.95.mk b/toolchain/gcc/gcc-uclibc-2.95.mk deleted file mode 100644 index e5a36e4ccb..0000000000 --- a/toolchain/gcc/gcc-uclibc-2.95.mk +++ /dev/null @@ -1,277 +0,0 @@ -# Makefile for to build a gcc/uClibc toolchain -# -# Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org> -# Copyright (C) 2004 Manuel Novoa III <mjn3@uclibc.org> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -ifeq ($(findstring 2.95,$(GCC_VERSION)),2.95) -GCC_VERSION:=$(strip $(GCC_VERSION)) - -GCC_SITE:=http://www.uclibc.org/downloads/toolchain -GCC_SOURCE:=gcc-20011006.tar.bz2 -GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-20011006 -GCC_CAT:=bzcat - -STLPORT_SITE=http://www.stlport.org/archive -STLPORT_SOURCE=STLport-4.5.3.tar.gz -STLPORT_DIR=$(TOOL_BUILD_DIR)/STLport-4.5.3 -GCC_STRIP_HOST_BINARIES:=true - -############################################################# -# -# Setup some initial stuff -# -############################################################# - -ifeq ($(BR2_INSTALL_LIBSTDCPP),y) -TARGET_LANGUAGES:=c,c++ -STLPORT_TARGET=stlport -else -TARGET_LANGUAGES:=c -STLPORT_TARGET= -endif - -############################################################# -# -# build the first pass gcc compiler -# -############################################################# -GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION)-initial - -$(DL_DIR)/$(GCC_SOURCE): - mkdir -p $(DL_DIR) - $(WGET) -P $(DL_DIR) $(GCC_SITE)/$(GCC_SOURCE) - -$(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE) - mkdir -p $(TOOL_BUILD_DIR) - $(GCC_CAT) $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) - - touch $(GCC_DIR)/.unpacked - -$(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked - # Apply any files named gcc-*.patch from the source directory to gcc - toolchain/patch-kernel.sh $(GCC_DIR) toolchain/gcc/$(GCC_VERSION) \*.patch\* - # - # We do not wish to build the libstdc++ library provided with gcc, - # since it doesn't seem to work at all with uClibc plus gcc 2.95... - # - mv $(GCC_DIR)/libstdc++ $(GCC_DIR)/libstdc++.orig - mv $(GCC_DIR)/libio $(GCC_DIR)/libio.orig - # - touch $(GCC_DIR)/.patched - -# The --without-headers option stopped working with gcc 3.0 and has never been -# # fixed, so we need to actually have working C library header files prior to -# # the step or libgcc will not build... -$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.patched - mkdir -p $(GCC_BUILD_DIR1) - -mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include - # Important! Required for limits.h to be fixed. - ln -sf include $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include - (cd $(GCC_BUILD_DIR1); PATH=$(TARGET_PATH) \ - $(GCC_DIR)/configure \ - --prefix=$(STAGING_DIR) \ - --build=$(GNU_HOST_NAME) \ - --host=$(GNU_HOST_NAME) \ - --target=$(REAL_GNU_TARGET_NAME) \ - --enable-languages=c \ - --disable-shared \ - --includedir=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include \ - --with-headers=$(TOOL_BUILD_DIR)/uClibc_dev/usr/include \ - --disable-__cxa_atexit \ - --enable-target-optspace \ - --with-gnu-ld \ - $(DISABLE_NLS) \ - $(MULTILIB) \ - $(SOFT_FLOAT_CONFIG_OPTION) \ - $(EXTRA_GCC_CONFIG_OPTIONS)); - touch $(GCC_BUILD_DIR1)/.configured - -$(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured - PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) all-gcc - touch $(GCC_BUILD_DIR1)/.compiled - -$(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc: $(GCC_BUILD_DIR1)/.compiled - PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) install-gcc - #rm -f $(STAGING_DIR)/bin/gccbug $(STAGING_DIR)/bin/gcov - #rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc $(STAGING_DIR)/share/locale - -gcc_initial: uclibc-configured binutils $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc - -gcc_initial-clean: - rm -rf $(GCC_BUILD_DIR1) - rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)* - -gcc_initial-dirclean: - rm -rf $(GCC_BUILD_DIR1) - -############################################################# -# -# STLport -- an alternative C++ library -# -############################################################# -STLPORT_PATCH=toolchain/gcc/2.95/STLport-4.5.3.patch - -$(DL_DIR)/$(STLPORT_SOURCE): - $(WGET) -P $(DL_DIR) $(STLPORT_SITE)/$(STLPORT_SOURCE) - -$(STLPORT_DIR)/Makefile: $(DL_DIR)/$(STLPORT_SOURCE) $(STLPORT_PATCH) - zcat $(DL_DIR)/$(STLPORT_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) - - cat $(STLPORT_PATCH) | patch -d $(STLPORT_DIR) -p1 - -$(STLPORT_DIR)/lib/libstdc++.a: $(STLPORT_DIR)/Makefile - $(MAKE) ARCH=$(OPTIMIZE_FOR_CPU) PREFIX=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) -C $(STLPORT_DIR) - -$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++.a: $(STLPORT_DIR)/lib/libstdc++.a - $(MAKE) ARCH=$(OPTIMIZE_FOR_CPU) PREFIX=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) -C $(STLPORT_DIR) install - -stlport: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++.a - -stlport-source: $(DL_DIR)/$(STLPORT_SOURCE) - -stlport-clean: - rm -f $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++* - rm -f $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include/c++* - -$(MAKE) -C $(STLPORT_DIR) clean - -stlport-dirclean: - rm -f $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libstdc++* - rm -f $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include/g++-v3* - rm -rf $(STLPORT_DIR) - -############################################################# -# -# second pass compiler build. Build the compiler targeting -# the newly built shared uClibc library. -# -############################################################# -GCC_BUILD_DIR2:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION)-final - -$(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.patched $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a - mkdir -p $(GCC_BUILD_DIR2) - (cd $(GCC_BUILD_DIR2); PATH=$(TARGET_PATH) \ - $(GCC_DIR)/configure \ - --prefix=$(STAGING_DIR) \ - --build=$(GNU_HOST_NAME) \ - --host=$(GNU_HOST_NAME) \ - --target=$(REAL_GNU_TARGET_NAME) \ - --enable-languages=$(TARGET_LANGUAGES) \ - --enable-shared \ - --with-gxx-include-dir=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include/c++ \ - --disable-__cxa_atexit \ - --enable-target-optspace \ - --with-gnu-ld \ - $(DISABLE_NLS) \ - $(MULTILIB) \ - $(SOFT_FLOAT_CONFIG_OPTION) \ - $(EXTRA_GCC_CONFIG_OPTIONS)); - touch $(GCC_BUILD_DIR2)/.configured - -$(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured - PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) all - touch $(GCC_BUILD_DIR2)/.compiled - -$(GCC_BUILD_DIR2)/.installed: $(GCC_BUILD_DIR2)/.compiled - PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) install - # Strip the host binaries -ifeq ($(GCC_STRIP_HOST_BINARIES),true) - -strip --strip-all -R .note -R .comment $(STAGING_DIR)/bin/* -endif - # Set up the symlinks to enable lying about target name. - set -e; \ - (cd $(STAGING_DIR); \ - ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \ - cd bin; \ - for app in $(REAL_GNU_TARGET_NAME)-* ; do \ - ln -sf $${app} \ - $(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \ - done; \ - ); - touch $(GCC_BUILD_DIR2)/.installed - -gcc: uclibc-configured binutils gcc_initial $(LIBFLOAT_TARGET) uclibc \ - $(GCC_BUILD_DIR2)/.installed $(GCC_TARGETS) $(STLPORT_TARGET) - -gcc-source: $(DL_DIR)/$(GCC_SOURCE) - -gcc-clean: - rm -rf $(GCC_BUILD_DIR2) - rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)* - -gcc-dirclean: - rm -rf $(GCC_BUILD_DIR2) - -############################################################# -# -# Next build target gcc compiler -# -############################################################# -GCC_BUILD_DIR3:=$(BUILD_DIR)/gcc-$(GCC_VERSION)-target - -$(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR2)/.installed - mkdir -p $(GCC_BUILD_DIR3) - (cd $(GCC_BUILD_DIR3); PATH=$(TARGET_PATH) \ - $(GCC_DIR)/configure \ - --prefix=/usr \ - --build=$(GNU_HOST_NAME) \ - --host=$(REAL_GNU_TARGET_NAME) \ - --target=$(REAL_GNU_TARGET_NAME) \ - --enable-languages=$(TARGET_LANGUAGES) \ - --enable-shared \ - --with-gxx-include-dir=/usr/include/c++ \ - --disable-__cxa_atexit \ - --enable-target-optspace \ - --with-gnu-ld \ - $(DISABLE_NLS) \ - $(MULTILIB) \ - $(SOFT_FLOAT_CONFIG_OPTION) \ - $(EXTRA_GCC_CONFIG_OPTIONS)); - touch $(GCC_BUILD_DIR3)/.configured - -$(GCC_BUILD_DIR3)/.compiled: $(GCC_BUILD_DIR3)/.configured - PATH=$(TARGET_PATH) \ - $(MAKE) $(TARGET_GCC_ARGS) -C $(GCC_BUILD_DIR3) all - touch $(GCC_BUILD_DIR3)/.compiled - -$(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled - PATH=$(TARGET_PATH) \ - $(MAKE) DESTDIR=$(TARGET_DIR) -C $(GCC_BUILD_DIR3) install - # Remove broken specs file (cross compile flag is set). - rm -f $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs - -(cd $(TARGET_DIR)/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1) - -(cd $(TARGET_DIR)/usr/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1) - -(cd $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION); $(STRIP) cc1 cc1plus collect2 > /dev/null 2>&1) - -(cd $(TARGET_DIR)/usr/lib; $(STRIP) libstdc++.so.*.*.* > /dev/null 2>&1) - -(cd $(TARGET_DIR)/lib; $(STRIP) libgcc_s.so.*.*.* > /dev/null 2>&1) - # - rm -f $(TARGET_DIR)/usr/lib/*.la* - #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ - # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc - # Work around problem of missing syslimits.h - cp -f $(STAGING_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/include/syslimits.h $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/include/ - # These are in /lib, so... - #rm -rf $(TARGET_DIR)/usr/lib/libgcc_s.so* - #touch -c $(TARGET_DIR)/usr/bin/gcc - -gcc_target: uclibc_target binutils_target $(TARGET_DIR)/usr/bin/gcc - -gcc_target-clean: - rm -rf $(GCC_BUILD_DIR3) - rm -f $(TARGET_DIR)/bin/$(REAL_GNU_TARGET_NAME)* - -gcc_target-dirclean: - rm -rf $(GCC_BUILD_DIR3) - -endif diff --git a/toolchain/gcc/gcc-uclibc-3.x.mk b/toolchain/gcc/gcc-uclibc-3.x.mk index d1d372ecfb..878a55d270 100644 --- a/toolchain/gcc/gcc-uclibc-3.x.mk +++ b/toolchain/gcc/gcc-uclibc-3.x.mk @@ -17,7 +17,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -ifneq ($(findstring 2.95,$(GCC_VERSION)),2.95) GCC_VERSION:=$(strip $(GCC_VERSION)) #GCC_SITE:=ftp://ftp.gnu.org/gnu/gcc/releases/gcc-$(GCC_VERSION) @@ -67,7 +66,7 @@ $(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE) $(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked # Apply any files named gcc-*.patch from the source directory to gcc - toolchain/patch-kernel.sh $(GCC_DIR) toolchain/gcc/$(GCC_VERSION) \*.patch + $(SCRIPT_DIR)/patch-kernel.sh $(GCC_DIR) ./$(GCC_VERSION) \*.patch # Note: The soft float situation has improved considerably with gcc 3.4.x. # We can dispense with the custom spec files, as well as libfloat for the arm case. # However, we still need a patch for arm. There's a similar patch for gcc 3.3.x @@ -75,10 +74,10 @@ $(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked # anyone (?) who might still be using gcc 2.95. mjn3 ifeq ($(BR2_SOFT_FLOAT),y) ifeq ("$(strip $(ARCH))","arm") - toolchain/patch-kernel.sh $(GCC_DIR) toolchain/gcc/$(GCC_VERSION) arm-softfloat.patch.conditional + $(SCRIPT_DIR)/patch-kernel.sh $(GCC_DIR) ./$(GCC_VERSION) arm-softfloat.patch.conditional endif ifeq ("$(strip $(ARCH))","armeb") - toolchain/patch-kernel.sh $(GCC_DIR) toolchain/gcc/$(GCC_VERSION) arm-softfloat.patch.conditional + $(SCRIPT_DIR)/patch-kernel.sh $(GCC_DIR) ./$(GCC_VERSION) arm-softfloat.patch.conditional endif # Not yet updated to 3.4.1. #ifeq ("$(strip $(ARCH))","i386") @@ -121,11 +120,10 @@ $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc: $(GCC_BUILD_DIR1)/.compiled #rm -f $(STAGING_DIR)/bin/gccbug $(STAGING_DIR)/bin/gcov #rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc $(STAGING_DIR)/share/locale -gcc_initial: uclibc-configured binutils $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc +gcc_initial: $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc gcc_initial-clean: rm -rf $(GCC_BUILD_DIR1) - rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)* gcc_initial-toolclean: rm -rf $(GCC_BUILD_DIR1) @@ -171,7 +169,7 @@ $(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) all touch $(GCC_BUILD_DIR2)/.compiled -$(GCC_BUILD_DIR2)/.installed: $(GCC_BUILD_DIR2)/.compiled +gcc-install: $(GCC_BUILD_DIR2)/.compiled PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) install # Strip the host binaries ifeq ($(GCC_STRIP_HOST_BINARIES),true) @@ -193,7 +191,7 @@ endif ifeq ($(BR2_SOFT_FLOAT),y) ifeq ($(findstring 3.3.,$(GCC_VERSION)),3.3.) # Make sure we have a soft float specs file for this arch - if [ ! -f toolchain/gcc/$(GCC_VERSION)/specs-$(ARCH)-soft-float ] ; then \ + if [ ! -f ./$(GCC_VERSION)/specs-$(ARCH)-soft-float ] ; then \ echo soft float configured but no specs file for this arch ; \ /bin/false ; \ fi; @@ -202,28 +200,24 @@ ifeq ($(findstring 3.3.,$(GCC_VERSION)),3.3.) echo staging dir specs file is missing ; \ /bin/false ; \ fi; - cp toolchain/gcc/$(GCC_VERSION)/specs-$(ARCH)-soft-float $(STAGING_DIR)/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs + cp ./$(GCC_VERSION)/specs-$(ARCH)-soft-float $(STAGING_DIR)/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs endif endif - # - # Ok... that's enough of that. - # - touch $(GCC_BUILD_DIR2)/.installed - -$(TARGET_DIR)/lib/libgcc_s.so.1: $(GCC_BUILD_DIR2)/.installed # These are in /lib, so... rm -rf $(TARGET_DIR)/usr/lib/libgcc_s.so* -$(STRIP) $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libgcc_s.so.1 -cp -a $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libgcc_s* $(TARGET_DIR)/lib/ -gcc: uclibc-configured binutils gcc_initial $(LIBFLOAT_TARGET) uclibc \ - $(TARGET_DIR)/lib/libgcc_s.so.1 $(GCC_BUILD_DIR2)/.installed $(GCC_TARGETS) +gcc: gcc_initial $(LIBFLOAT_TARGET) \ + gcc-install $(GCC_TARGETS) gcc-source: $(DL_DIR)/$(GCC_SOURCE) gcc-clean: + rm -rf $(GCC_DIR) rm -rf $(GCC_BUILD_DIR2) - rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)* + rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gc* + rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-c* gcc-toolclean: rm -rf $(GCC_BUILD_DIR2) @@ -235,7 +229,7 @@ gcc-toolclean: ############################################################# GCC_BUILD_DIR3:=$(BUILD_DIR)/gcc-$(GCC_VERSION)-target -$(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR2)/.installed +$(GCC_BUILD_DIR3)/.configured: gcc-install mkdir -p $(GCC_BUILD_DIR3) (cd $(GCC_BUILD_DIR3); PATH=$(TARGET_PATH) \ $(GCC_DIR)/configure \ @@ -282,7 +276,7 @@ $(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled ifeq ($(BR2_SOFT_FLOAT),y) ifeq ($(findstring 3.3.,$(GCC_VERSION)),3.3.) # Add a specs file that defaults to soft float mode. - cp toolchain/gcc/$(GCC_VERSION)/specs-$(ARCH)-soft-float $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs + cp ./$(GCC_VERSION)/specs-$(ARCH)-soft-float $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs # Make sure gcc does not think we are cross compiling $(SED) "s/^1/0/;" $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs endif @@ -318,4 +312,3 @@ gcc_target-clean: gcc_target-toolclean: rm -rf $(GCC_BUILD_DIR3) -endif diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile new file mode 100644 index 0000000000..2b590c8a09 --- /dev/null +++ b/toolchain/kernel-headers/Makefile @@ -0,0 +1,10 @@ +include $(TOPDIR)/rules.mk + +include ./kernel-headers.mk + +source: kernel-headers-source +prepare: kernel-headers +compile: +install: +clean: kernel-headers-toolclean + diff --git a/toolchain/kernel-headers/kernel-headers.mk b/toolchain/kernel-headers/kernel-headers.mk index 9edf1a0f1b..9ef884ef4c 100644 --- a/toolchain/kernel-headers/kernel-headers.mk +++ b/toolchain/kernel-headers/kernel-headers.mk @@ -3,8 +3,7 @@ LINUX_HEADERS_VERSION=2.4.29 LINUX_HEADERS_SITE=http://www.kernel.org/pub/linux/kernel/v2.4 LINUX_HEADERS_SOURCE=linux-$(LINUX_HEADERS_VERSION).tar.bz2 -LINUX_HEADERS_CONFIG=toolchain/kernel-headers/linux.config -LINUX_HEADERS_DIR=$(TOOL_BUILD_DIR)/linux-$(LINUX_HEADERS_VERSION) +LINUX_HEADERS_CONFIG=./linux.config LINUX_HEADERS_ARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \ -e 's/mipsel/mips/' \ -e 's/powerpc/ppc/' \ @@ -26,6 +25,7 @@ $(LINUX_HEADERS_DIR)/.unpacked: $(DL_DIR)/$(LINUX_HEADERS_SOURCE) linux-$(LINUX_HEADERS_VERSION)/arch/$(LINUX_HEADERS_ARCH)/config*.in \ linux-$(LINUX_HEADERS_VERSION)/*/*/Config.in \ linux-$(LINUX_HEADERS_VERSION)/*/Config.in + ln -sf $(LINUX_HEADERS_DIR)-$(LINUX_HEADERS_VERSION) $(LINUX_HEADERS_DIR) touch $(LINUX_HEADERS_DIR)/.unpacked $(LINUX_HEADERS_DIR)/.configured: $(LINUX_HEADERS_DIR)/.unpacked diff --git a/toolchain/patch-kernel.sh b/toolchain/patch-kernel.sh deleted file mode 100755 index 79401c2a74..0000000000 --- a/toolchain/patch-kernel.sh +++ /dev/null @@ -1,53 +0,0 @@ -#! /bin/sh -# A little script I whipped up to make it easy to -# patch source trees and have sane error handling -# -Erik -# -# (c) 2002 Erik Andersen <andersen@codepoet.org> - -# Set directories from arguments, or use defaults. -targetdir=${1-.} -patchdir=${2-../kernel-patches} -patchpattern=${3-*} - -if [ ! -d "${targetdir}" ] ; then - echo "Aborting. '${targetdir}' is not a directory." - exit 1 -fi -if [ ! -d "${patchdir}" ] ; then - echo "Aborting. '${patchdir}' is not a directory." - exit 1 -fi - -for i in ${patchdir}/${patchpattern} ; do - case "$i" in - *.gz) - type="gzip"; uncomp="gunzip -dc"; ;; - *.bz) - type="bzip"; uncomp="bunzip -dc"; ;; - *.bz2) - type="bzip2"; uncomp="bunzip2 -dc"; ;; - *.zip) - type="zip"; uncomp="unzip -d"; ;; - *.Z) - type="compress"; uncomp="uncompress -c"; ;; - *) - type="plaintext"; uncomp="cat"; ;; - esac - echo "" - echo "Applying ${i} using ${type}: " - ${uncomp} ${i} | patch -p1 -E -d ${targetdir} - if [ $? != 0 ] ; then - echo "Patch failed! Please fix $i!" - exit 1 - fi -done - -# Check for rejects... -if [ "`find $targetdir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ] ; then - echo "Aborting. Reject files found." - exit 1 -fi - -# Remove backup files -find $targetdir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \; diff --git a/toolchain/uClibc/Makefile b/toolchain/uClibc/Makefile new file mode 100644 index 0000000000..06d7487a4f --- /dev/null +++ b/toolchain/uClibc/Makefile @@ -0,0 +1,10 @@ +include $(TOPDIR)/rules.mk + +include ./uclibc.mk + +source: uclibc-source +prepare: uclibc-configured +compile: $(UCLIBC_DIR)/lib/libc.a +install: uclibc + $(STRIP) $(TARGET_DIR)/lib/*.so +clean: uclibc-clean diff --git a/toolchain/uClibc/uclibc.mk b/toolchain/uClibc/uclibc.mk index 15cf6b2793..eec100f83b 100644 --- a/toolchain/uClibc/uclibc.mk +++ b/toolchain/uClibc/uclibc.mk @@ -11,8 +11,6 @@ UCLIBC_SOURCE:=uClibc-$(strip $(subst ",, $(BR2_USE_UCLIBC_SNAPSHOT))).tar.bz2 #" UCLIBC_SITE:=http://www.uclibc.org/downloads/snapshots else -# Note: 0.9.26 has known problems. So best use a snapshot until .27 is out. -# Anticipate the change. UCLIBC_DIR:=$(TOOL_BUILD_DIR)/uClibc-0.9.27 UCLIBC_SOURCE:=uClibc-0.9.27.tar.bz2 UCLIBC_SITE:=http://www.uclibc.org/downloads @@ -45,9 +43,9 @@ $(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE) $(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(UCLIBC_DIR)/Rules.mak ifeq ($(BR2_ENABLE_LOCALE),y) - cp toolchain/uClibc/uClibc.config-locale $(UCLIBC_DIR)/.config + cp ./uClibc.config-locale $(UCLIBC_DIR)/.config else - cp toolchain/uClibc/uClibc.config $(UCLIBC_DIR)/.config + cp ./uClibc.config $(UCLIBC_DIR)/.config endif $(SED) 's,^.*TARGET_$(UCLIBC_TARGET_ARCH).*,TARGET_$(UCLIBC_TARGET_ARCH)=y,g' \ $(UCLIBC_DIR)/.config @@ -126,7 +124,7 @@ endif uclibc-configured: $(UCLIBC_DIR)/.configured -uclibc: $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc $(STAGING_DIR)/lib/libc.a \ +uclibc: $(STAGING_DIR)/lib/libc.a \ $(UCLIBC_TARGETS) uclibc-source: $(DL_DIR)/$(UCLIBC_SOURCE) diff --git a/toolchain/utils/Makefile b/toolchain/utils/Makefile new file mode 100644 index 0000000000..404a5e5fda --- /dev/null +++ b/toolchain/utils/Makefile @@ -0,0 +1,21 @@ +include $(TOPDIR)/rules.mk + +TARGETS:=sstrip +UTILS_BUILD_DIR:=$(TOOL_BUILD_DIR)/utils + +prepare: $(UTILS_BUILD_DIR) +compile: prepare $(patsubst %,$(UTILS_BUILD_DIR)/%,$(TARGETS)) +install: compile + mkdir -p $(STAGING_DIR)/bin + cp -a $(UTILS_BUILD_DIR)/* $(STAGING_DIR)/bin/ +package: +clean: + rm -rf $(UTILS_BUILD_DIR) + +$(UTILS_BUILD_DIR): + mkdir -p $(UTILS_BUILD_DIR) + +$(UTILS_BUILD_DIR)/%: src/%.c + $(CC) -o $@ $(patsubst $(UTILS_BUILD_DIR)/%,src/%.c,$@) + chmod 755 $@ + diff --git a/toolchain/utils/src/sstrip.c b/toolchain/utils/src/sstrip.c new file mode 100644 index 0000000000..e820a44b88 --- /dev/null +++ b/toolchain/utils/src/sstrip.c @@ -0,0 +1,483 @@ +/* http://www.muppetlabs.com/~breadbox/software/elfkickers.html */ + +/* sstrip: Copyright (C) 1999-2001 by Brian Raiter, under the GNU + * General Public License. No warranty. See COPYING for details. + * + * Aug 23, 2004 Hacked by Manuel Novoa III <mjn3@codepoet.org> to + * handle targets of different endianness and/or elf class, making + * it more useful in a cross-devel environment. + */ + +/* ============== original README =================== + * + * sstrip is a small utility that removes the contents at the end of an + * ELF file that are not part of the program's memory image. + * + * Most ELF executables are built with both a program header table and a + * section header table. However, only the former is required in order + * for the OS to load, link and execute a program. sstrip attempts to + * extract the ELF header, the program header table, and its contents, + * leaving everything else in the bit bucket. It can only remove parts of + * the file that occur at the end, after the parts to be saved. However, + * this almost always includes the section header table, and occasionally + * a few random sections that are not used when running a program. + * + * It should be noted that the GNU bfd library is (understandably) + * dependent on the section header table as an index to the file's + * contents. Thus, an executable file that has no section header table + * cannot be used with gdb, objdump, or any other program based upon the + * bfd library, at all. In fact, the program will not even recognize the + * file as a valid executable. (This limitation is noted in the source + * code comments for bfd, and is marked "FIXME", so this may change at + * some future date. However, I would imagine that it is a pretty + * low-priority item, as executables without a section header table are + * rare in the extreme.) This probably also explains why strip doesn't + * offer the option to do this. + * + * Shared library files may also have their section header table removed. + * Such a library will still function; however, it will no longer be + * possible for a compiler to link a new program against it. + * + * As an added bonus, sstrip also tries to removes trailing zero bytes + * from the end of the file. (This normally cannot be done with an + * executable that has a section header table.) + * + * sstrip is a very simplistic program. It depends upon the common + * practice of putting the parts of the file that contribute to the + * memory image at the front, and the remaining material at the end. This + * permits it to discard the latter material without affecting file + * offsets and memory addresses in what remains. Of course, the ELF + * standard permits files to be organized in almost any order, so if a + * pathological linker decided to put its section headers at the top, + * sstrip would be useless on such executables. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <unistd.h> +#include <fcntl.h> +#include <elf.h> +#ifdef __FreeBSD__ +/** + * This seems to work on FreeBSD 5.3, should + * work on all newer versions as well. I have + * no idea if it will work on versions < 5.3 + * + * Joe Estock (guru) <jestock at nutextonline.com> + */ +#include <sys/endian.h> +#define bswap_64 __bswap64 +#define bswap_32 __bswap32 +#define bswap_16 __bswap16 +#else +#include <endian.h> +#include <byteswap.h> +#endif /* defined(__FreeBSD__) */ + + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +/* The name of the program. + */ +static char const *progname; + +/* The name of the current file. + */ +static char const *filename; + + +/* A simple error-handling function. FALSE is always returned for the + * convenience of the caller. + */ +static int err(char const *errmsg) +{ + fprintf(stderr, "%s: %s: %s\n", progname, filename, errmsg); + return FALSE; +} + +/* A flag to signal the need for endian reversal. + */ +static int do_reverse_endian; + +/* Get a value from the elf header, compensating for endianness. + */ +#define EGET(X) \ + (__extension__ ({ \ + uint64_t __res; \ + if (!do_reverse_endian) { \ + __res = (X); \ + } else if (sizeof(X) == 1) { \ + __res = (X); \ + } else if (sizeof(X) == 2) { \ + __res = bswap_16((X)); \ + } else if (sizeof(X) == 4) { \ + __res = bswap_32((X)); \ + } else if (sizeof(X) == 8) { \ + __res = bswap_64((X)); \ + } else { \ + fprintf(stderr, "%s: %s: EGET failed for size %d\n", \ + progname, filename, sizeof(X)); \ + exit(EXIT_FAILURE); \ + } \ + __res; \ + })) + +/* Set a value 'Y' in the elf header to 'X', compensating for endianness. + */ +#define ESET(Y,X) \ + do if (!do_reverse_endian) { \ + Y = (X); \ + } else if (sizeof(Y) == 1) { \ + Y = (X); \ + } else if (sizeof(Y) == 2) { \ + Y = bswap_16((uint16_t)(X)); \ + } else if (sizeof(Y) == 4) { \ + Y = bswap_32((uint32_t)(X)); \ + } else if (sizeof(Y) == 8) { \ + Y = bswap_64((uint64_t)(X)); \ + } else { \ + fprintf(stderr, "%s: %s: ESET failed for size %d\n", \ + progname, filename, sizeof(Y)); \ + exit(EXIT_FAILURE); \ + } while (0) + + +/* A macro for I/O errors: The given error message is used only when + * errno is not set. + */ +#define ferr(msg) (err(errno ? strerror(errno) : (msg))) + + + +#define HEADER_FUNCTIONS(CLASS) \ + \ +/* readelfheader() reads the ELF header into our global variable, and \ + * checks to make sure that this is in fact a file that we should be \ + * munging. \ + */ \ +static int readelfheader ## CLASS (int fd, Elf ## CLASS ## _Ehdr *ehdr) \ +{ \ + if (read(fd, ((char *)ehdr)+EI_NIDENT, sizeof(*ehdr) - EI_NIDENT) \ + != sizeof(*ehdr) - EI_NIDENT) \ + return ferr("missing or incomplete ELF header."); \ + \ + /* Verify the sizes of the ELF header and the program segment \ + * header table entries. \ + */ \ + if (EGET(ehdr->e_ehsize) != sizeof(Elf ## CLASS ## _Ehdr)) \ + return err("unrecognized ELF header size."); \ + if (EGET(ehdr->e_phentsize) != sizeof(Elf ## CLASS ## _Phdr)) \ + return err("unrecognized program segment header size."); \ + \ + /* Finally, check the file type. \ + */ \ + if (EGET(ehdr->e_type) != ET_EXEC && EGET(ehdr->e_type) != ET_DYN) \ + return err("not an executable or shared-object library."); \ + \ + return TRUE; \ +} \ + \ +/* readphdrtable() loads the program segment header table into memory. \ + */ \ +static int readphdrtable ## CLASS (int fd, Elf ## CLASS ## _Ehdr const *ehdr, \ + Elf ## CLASS ## _Phdr **phdrs) \ +{ \ + size_t size; \ + \ + if (!EGET(ehdr->e_phoff) || !EGET(ehdr->e_phnum) \ +) return err("ELF file has no program header table."); \ + \ + size = EGET(ehdr->e_phnum) * sizeof **phdrs; \ + if (!(*phdrs = malloc(size))) \ + return err("Out of memory!"); \ + \ + errno = 0; \ + if (read(fd, *phdrs, size) != (ssize_t)size) \ + return ferr("missing or incomplete program segment header table."); \ + \ + return TRUE; \ +} \ + \ +/* getmemorysize() determines the offset of the last byte of the file \ + * that is referenced by an entry in the program segment header table. \ + * (Anything in the file after that point is not used when the program \ + * is executing, and thus can be safely discarded.) \ + */ \ +static int getmemorysize ## CLASS (Elf ## CLASS ## _Ehdr const *ehdr, \ + Elf ## CLASS ## _Phdr const *phdrs, \ + unsigned long *newsize) \ +{ \ + Elf ## CLASS ## _Phdr const *phdr; \ + unsigned long size, n; \ + int i; \ + \ + /* Start by setting the size to include the ELF header and the \ + * complete program segment header table. \ + */ \ + size = EGET(ehdr->e_phoff) + EGET(ehdr->e_phnum) * sizeof *phdrs; \ + if (size < sizeof *ehdr) \ + size = sizeof *ehdr; \ + \ + /* Then keep extending the size to include whatever data the \ + * program segment header table references. \ + */ \ + for (i = 0, phdr = phdrs ; i < EGET(ehdr->e_phnum) ; ++i, ++phdr) { \ + if (EGET(phdr->p_type) != PT_NULL) { \ + n = EGET(phdr->p_offset) + EGET(phdr->p_filesz); \ + if (n > size) \ + size = n; \ + } \ + } \ + \ + *newsize = size; \ + return TRUE; \ +} \ + \ +/* modifyheaders() removes references to the section header table if \ + * it was stripped, and reduces program header table entries that \ + * included truncated bytes at the end of the file. \ + */ \ +static int modifyheaders ## CLASS (Elf ## CLASS ## _Ehdr *ehdr, \ + Elf ## CLASS ## _Phdr *phdrs, \ + unsigned long newsize) \ +{ \ + Elf ## CLASS ## _Phdr *phdr; \ + int i; \ + \ + /* If the section header table is gone, then remove all references \ + * to it in the ELF header. \ + */ \ + if (EGET(ehdr->e_shoff) >= newsize) { \ + ESET(ehdr->e_shoff,0); \ + ESET(ehdr->e_shnum,0); \ + ESET(ehdr->e_shentsize,0); \ + ESET(ehdr->e_shstrndx,0); \ + } \ + \ + /* The program adjusts the file size of any segment that was \ + * truncated. The case of a segment being completely stripped out \ + * is handled separately. \ + */ \ + for (i = 0, phdr = phdrs ; i < EGET(ehdr->e_phnum) ; ++i, ++phdr) { \ + if (EGET(phdr->p_offset) >= newsize) { \ + ESET(phdr->p_offset,newsize); \ + ESET(phdr->p_filesz,0); \ + } else if (EGET(phdr->p_offset) + EGET(phdr->p_filesz) > newsize) { \ + newsize -= EGET(phdr->p_offset); \ + ESET(phdr->p_filesz, newsize); \ + } \ + } \ + \ + return TRUE; \ +} \ + \ +/* commitchanges() writes the new headers back to the original file \ + * and sets the file to its new size. \ + */ \ +static int commitchanges ## CLASS (int fd, Elf ## CLASS ## _Ehdr const *ehdr, \ + Elf ## CLASS ## _Phdr *phdrs, \ + unsigned long newsize) \ +{ \ + size_t n; \ + \ + /* Save the changes to the ELF header, if any. \ + */ \ + if (lseek(fd, 0, SEEK_SET)) \ + return ferr("could not rewind file"); \ + errno = 0; \ + if (write(fd, ehdr, sizeof *ehdr) != sizeof *ehdr) \ + return err("could not modify file"); \ + \ + /* Save the changes to the program segment header table, if any. \ + */ \ + if (lseek(fd, EGET(ehdr->e_phoff), SEEK_SET) == (off_t)-1) { \ + err("could not seek in file."); \ + goto warning; \ + } \ + n = EGET(ehdr->e_phnum) * sizeof *phdrs; \ + if (write(fd, phdrs, n) != (ssize_t)n) { \ + err("could not write to file"); \ + goto warning; \ + } \ + \ + /* Eleventh-hour sanity check: don't truncate before the end of \ + * the program segment header table. \ + */ \ + if (newsize < EGET(ehdr->e_phoff) + n) \ + newsize = EGET(ehdr->e_phoff) + n; \ + \ + /* Chop off the end of the file. \ + */ \ + if (ftruncate(fd, newsize)) { \ + err("could not resize file"); \ + goto warning; \ + } \ + \ + return TRUE; \ + \ + warning: \ + return err("ELF file may have been corrupted!"); \ +} + + +/* First elements of Elf32_Ehdr and Elf64_Ehdr are common. + */ +static int readelfheaderident(int fd, Elf32_Ehdr *ehdr) +{ + errno = 0; + if (read(fd, ehdr, EI_NIDENT) != EI_NIDENT) + return ferr("missing or incomplete ELF header."); + + /* Check the ELF signature. + */ + if (!(ehdr->e_ident[EI_MAG0] == ELFMAG0 && + ehdr->e_ident[EI_MAG1] == ELFMAG1 && + ehdr->e_ident[EI_MAG2] == ELFMAG2 && + ehdr->e_ident[EI_MAG3] == ELFMAG3)) + { + err("missing ELF signature."); + return -1; + } + + /* Compare the file's class and endianness with the program's. + */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) { + do_reverse_endian = 0; + } else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) { +/* fprintf(stderr, "ELF file has different endianness.\n"); */ + do_reverse_endian = 1; + } +#elif __BYTE_ORDER == __BIG_ENDIAN + if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) { +/* fprintf(stderr, "ELF file has different endianness.\n"); */ + do_reverse_endian = 1; + } else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) { + do_reverse_endian = 0; + } +#else +#error unkown endianness +#endif + else { + err("Unsupported endianness"); + return -1; + } + + /* Check the target architecture. + */ +/* if (EGET(ehdr->e_machine) != ELF_ARCH) { */ +/* /\* return err("ELF file created for different architecture."); *\/ */ +/* fprintf(stderr, "ELF file created for different architecture.\n"); */ +/* } */ + return ehdr->e_ident[EI_CLASS]; +} + + +HEADER_FUNCTIONS(32) + +HEADER_FUNCTIONS(64) + +/* truncatezeros() examines the bytes at the end of the file's + * size-to-be, and reduces the size to exclude any trailing zero + * bytes. + */ +static int truncatezeros(int fd, unsigned long *newsize) +{ + unsigned char contents[1024]; + unsigned long size, n; + + size = *newsize; + do { + n = sizeof contents; + if (n > size) + n = size; + if (lseek(fd, size - n, SEEK_SET) == (off_t)-1) + return ferr("cannot seek in file."); + if (read(fd, contents, n) != (ssize_t)n) + return ferr("cannot read file contents"); + while (n && !contents[--n]) + --size; + } while (size && !n); + + /* Sanity check. + */ + if (!size) + return err("ELF file is completely blank!"); + + *newsize = size; + return TRUE; +} + +/* main() loops over the cmdline arguments, leaving all the real work + * to the other functions. + */ +int main(int argc, char *argv[]) +{ + int fd; + union { + Elf32_Ehdr ehdr32; + Elf64_Ehdr ehdr64; + } e; + union { + Elf32_Phdr *phdrs32; + Elf64_Phdr *phdrs64; + } p; + unsigned long newsize; + char **arg; + int failures = 0; + + if (argc < 2 || argv[1][0] == '-') { + printf("Usage: sstrip FILE...\n" + "sstrip discards all nonessential bytes from an executable.\n\n" + "Version 2.0-X Copyright (C) 2000,2001 Brian Raiter.\n" + "Cross-devel hacks Copyright (C) 2004 Manuel Novoa III.\n" + "This program is free software, licensed under the GNU\n" + "General Public License. There is absolutely no warranty.\n"); + return EXIT_SUCCESS; + } + + progname = argv[0]; + + for (arg = argv + 1 ; *arg != NULL ; ++arg) { + filename = *arg; + + fd = open(*arg, O_RDWR); + if (fd < 0) { + ferr("can't open"); + ++failures; + continue; + } + + switch (readelfheaderident(fd, &e.ehdr32)) { + case ELFCLASS32: + if (!(readelfheader32(fd, &e.ehdr32) && + readphdrtable32(fd, &e.ehdr32, &p.phdrs32) && + getmemorysize32(&e.ehdr32, p.phdrs32, &newsize) && + truncatezeros(fd, &newsize) && + modifyheaders32(&e.ehdr32, p.phdrs32, newsize) && + commitchanges32(fd, &e.ehdr32, p.phdrs32, newsize))) + ++failures; + break; + case ELFCLASS64: + if (!(readelfheader64(fd, &e.ehdr64) && + readphdrtable64(fd, &e.ehdr64, &p.phdrs64) && + getmemorysize64(&e.ehdr64, p.phdrs64, &newsize) && + truncatezeros(fd, &newsize) && + modifyheaders64(&e.ehdr64, p.phdrs64, newsize) && + commitchanges64(fd, &e.ehdr64, p.phdrs64, newsize))) + ++failures; + break; + default: + ++failures; + break; + } + close(fd); + } + + return failures ? EXIT_FAILURE : EXIT_SUCCESS; +} |