From de5df0533c0bde20f08d788543feac6915a2a5f7 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Sun, 27 May 2007 20:22:06 +0000 Subject: Merge the NPTL stuff. That still leaves the linuxthreads stuff broken, but it was just before. I don't care anyway. Time to fix that later... diff --git a/Makefile b/Makefile index 1e86f70..823e97e 100644 --- a/Makefile +++ b/Makefile @@ -31,10 +31,15 @@ help:: @echo ' distclean - Remove generated files, configuration and build directories' include $(CT_TOP_DIR)/tools/Makefile +include $(CT_TOP_DIR)/Makefile.steps help:: @echo 'Distribution targets:' @echo ' tarball - Build a tarball of the configured toolchain' + @echo '' + @echo 'Environement variables:' + @echo ' STOP - Stop the build just after this step' + @echo ' RESTART - Restart the build just before this step' @echo @echo 'Environement variables:' @echo ' STOP - Stop the build just after this step' @@ -56,4 +61,5 @@ tarball: .PHONY: distclean distclean:: clean @rm -f .config* ..config.tmp + @rm -f log.* @rm -rf "$(CT_TOP_DIR)/targets" diff --git a/Makefile.steps b/Makefile.steps new file mode 100644 index 0000000..4b18165 --- /dev/null +++ b/Makefile.steps @@ -0,0 +1,50 @@ +# Makefile for each steps +# Copyright 2006 Yann E. MORIN + +libc_check_config \ +kernel_check_config \ +kernel_headers \ +binutils \ +cc_core_pass_1 \ +libc_headers \ +libc_start_files \ +cc_core_pass_2 \ +libfloat \ +libc \ +cc \ +libc_finish \ +debug \ +: + @make -C "$(CT_TOP_DIR)" RESTART=$@ STOP=$@ + +-libc_check_config \ +-kernel_check_config \ +-kernel_headers \ +-binutils \ +-cc_core_pass_1 \ +-libc_headers \ +-libc_start_files \ +-cc_core_pass_2 \ +-libfloat \ +-libc \ +-cc \ +-libc_finish \ +-debug \ +: + @make -C "$(CT_TOP_DIR)" STOP=$(patsubst -%,%,$@) + +libc_check_config- \ +kernel_check_config- \ +kernel_headers- \ +binutils- \ +cc_core_pass_1- \ +libc_headers- \ +libc_start_files- \ +cc_core_pass_2- \ +libfloat- \ +libc- \ +cc- \ +libc_finish- \ +debug- \ +: + @make -C "$(CT_TOP_DIR)" RESTART=$(patsubst %-,%,$@) diff --git a/config/kernel_linux_headers_install.in b/config/kernel_linux_headers_install.in index a2e1d7b..072dd28 100644 --- a/config/kernel_linux_headers_install.in +++ b/config/kernel_linux_headers_install.in @@ -98,6 +98,16 @@ config KERNEL_INSTALL_V_2_6_21_1 prompt "2.6.21.1" depends on KERNEL_VERSION_SEE_EXTRAVERSION +config KERNEL_INSTALL_V_2_6_21_2 + bool + prompt "2.6.21.2" + depends on KERNEL_VERSION_SEE_EXTRAVERSION + +config KERNEL_INSTALL_V_2_6_21_3 + bool + prompt "2.6.21.3" + depends on KERNEL_VERSION_SEE_EXTRAVERSION + # CT_INSERT_VERSION_ABOVE # Don't remove above line! endchoice @@ -124,5 +134,7 @@ config KERNEL_VERSION default "2.6.20.7" if KERNEL_INSTALL_V_2_6_20_7 default "2.6.21" if KERNEL_INSTALL_V_2_6_21 default "2.6.21.1" if KERNEL_INSTALL_V_2_6_21_1 + default "2.6.21.2" if KERNEL_INSTALL_V_2_6_21_2 + default "2.6.21.3" if KERNEL_INSTALL_V_2_6_21_3 # CT_INSERT_VERSION_STRING_ABOVE # Don't remove above line! diff --git a/config/libc.in b/config/libc.in index da86f1c..e919ba8 100644 --- a/config/libc.in +++ b/config/libc.in @@ -36,31 +36,6 @@ config LIBC_SUPPORT_LINUXTHREADS bool default n -choice - bool - prompt "Threading implentation to use:" - default LIBC_THREADS_NPTL if LIBC_SUPPORT_NPTL - default LIBC_THREADS_LINUXTHREADS if LIBC_SUPPORT_LINUXTHREADS && ! LIBC_SUPPORT_NPTL - default LIBC_THREADS_NONE if ! LIBC_SUPPORT_LINUXTHREADS && ! LIBC_SUPPORT_NPTL - depends on EXPERIMENTAL - -config LIBC_THREADS_NPTL - bool - prompt "nptl (EXPERIMENTAL)" - depends on LIBC_SUPPORT_NPTL - depends on EXPERIMENTAL - -config LIBC_THREADS_LINUXTHREADS - bool - prompt "linuxthreads" - depends on LIBC_SUPPORT_LINUXTHREADS - -config LIBC_THREADS_NONE - bool - prompt "none" - -endchoice - if LIBC_GLIBC source config/libc_glibc.in endif diff --git a/config/libc_glibc.in b/config/libc_glibc.in index d1b4be3..c0454d2 100644 --- a/config/libc_glibc.in +++ b/config/libc_glibc.in @@ -181,7 +181,7 @@ config LIBC_GLIBC_CONFIGPARMS config LIBC_GLIBC_USE_PORTS bool prompt "Use the ports addon" - default y + default n help The ports addon contains some architecture ports that are not available in the official glibc distribution. diff --git a/config/target.in b/config/target.in index 5cad782..1fcfc30 100644 --- a/config/target.in +++ b/config/target.in @@ -19,53 +19,74 @@ choice config ARCH_ARM bool prompt "arm" - select ARCH_SUPPORTS_BE - select ARCH_SUPPORTS_LE + select ARCH_SUPPORTS_BOTH_ENDIAN select ARCH_SUPPORTS_LIBFLOAT config ARCH_MIPS bool prompt "mips" - select ARCH_SUPPORTS_BE - select ARCH_SUPPORTS_LE + select ARCH_SUPPORTS_BOTH_ENDIAN config ARCH_x86 bool prompt "x86" - select ARCH_SUPPORTS_LE select ARCH_SUPPORTS_LIBFLOAT config ARCH_x86_64 bool prompt "x86_64" - select ARCH_SUPPORTS_LE endchoice -config ARCH_SUPPORTS_BE - bool - default n - -config ARCH_SUPPORTS_LE +config ARCH_SUPPORTS_BOTH_ENDIAN bool default n choice bool prompt "Endianness:" + depends on ARCH_SUPPORTS_BOTH_ENDIAN config ARCH_BE bool prompt "Big endian" - depends on ARCH_SUPPORTS_BE config ARCH_LE bool prompt "Little endian" - depends on ARCH_SUPPORTS_LE endchoice +choice + bool + prompt "Threading implentation to use:" + default THREADS_NPTL if LIBC_SUPPORT_NPTL + default THREADS_LINUXTHREADS if LIBC_SUPPORT_LINUXTHREADS && ! LIBC_SUPPORT_NPTL + default THREADS_NONE if ! LIBC_SUPPORT_LINUXTHREADS && ! LIBC_SUPPORT_NPTL + +config THREADS_NPTL + bool + prompt "nptl (EXPERIMENTAL)" + depends on LIBC_SUPPORT_NPTL + depends on EXPERIMENTAL + +config THREADS_LINUXTHREADS + bool + prompt "linuxthreads" + depends on LIBC_SUPPORT_LINUXTHREADS + +config THREADS_NONE + bool + prompt "none" + +endchoice + +config THREADS + string + default "nptl" if THREADS_NPTL + default "linuxthreads" if THREADS_LINUXTHREADS + default "none" if THREADS_NONE + comment "Target optimisations" config ARCH_ARCH diff --git a/docs/overview.txt b/docs/overview.txt index 1425ed6..7bc9f61 100644 --- a/docs/overview.txt +++ b/docs/overview.txt @@ -127,14 +127,27 @@ The list of steps is, in order of appearence in the build process: - kernel_check_config - kernel_headers - binutils + - cc_core_pass_1 - libc_headers - - cc_core + - libc_start_files + - cc_core_pass_2 - libfloat - libc - cc - libc_finish - debug +Alternatively, you can call make with the name of a step to just do that step: + make libc_headers +is equivalent to: + make RESTART=libs_headers STOP=libc_headers + +The shortcuts -step_name and step_name- allow to respectively stop or restart +at that step. Thus: + make -libc_headers make libc_headers- +are equivalent to: + make STOP=libc_headers make RESTART=libc_headers + ____________________________ / Configuring crosstool-NG / diff --git a/patches/gcc/4.1.2/801-softfloat-fix.patch b/patches/gcc/4.1.2/801-softfloat-fix.patch new file mode 100644 index 0000000..844c9a0 --- /dev/null +++ b/patches/gcc/4.1.2/801-softfloat-fix.patch @@ -0,0 +1,58 @@ +This patch (C) 2007 Yann E. MORIN +Licensed under GPL v2. + +First hunk of this patch solves compiling uClibc-0.9.28{,.1} : + +make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' + LD libuClibc-0.9.29.so +libc/libc_so.a(difftime.os): In function `difftime': +difftime.c:(.text+0x8): undefined reference to `__floatsidf' +difftime.c:(.text+0x2c): undefined reference to `__subdf3' +libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': +_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' +_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' +_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' +_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' +_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' +_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' +_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' +libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': +__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' +libc/libc_so.a(strtof.os): In function `strtof': +strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' +/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): +In function `__fixunsdfsi': +libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' +make[2]: *** [lib/libc.so] Error 1 +make[1]: *** [lib/libc.so.0] Error 2 +make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' +make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] +Error 2 + +The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). + + +diff -dur gcc-4.1.1.no-softfloat-fix/gcc/config.gcc gcc-4.1.1/gcc/config.gcc +--- gcc-4.1.1.no-softfloat-fix/gcc/config.gcc 2007-02-01 21:57:17.000000000 +0100 ++++ gcc-4.1.1/gcc/config.gcc 2007-02-01 22:11:06.000000000 +0100 +@@ -690,7 +690,7 @@ + default_use_cxa_atexit=yes + ;; + *) +- tmake_file="$tmake_file arm/t-linux" ++ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" + ;; + esac + tm_file="$tm_file arm/aout.h arm/arm.h" +diff -dur gcc-4.1.1.-lfloat/gcc/config/arm/linux-elf.h gcc-4.1.1/gcc/config/arm/linux-elf.h +--- gcc-4.1.1.-lfloat/gcc/config/arm/linux-elf.h 2007-02-01 21:57:17.000000000 +0100 ++++ gcc-4.1.1/gcc/config/arm/linux-elf.h 2007-02-01 23:00:42.000000000 +0100 +@@ -63,7 +63,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #ifdef USE_UCLIBC + #define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0" diff --git a/patches/glibc/2.5/glibc-2.4-i686-assembler.patch b/patches/glibc/2.5/glibc-2.4-i686-assembler.patch new file mode 100644 index 0000000..9904efb --- /dev/null +++ b/patches/glibc/2.5/glibc-2.4-i686-assembler.patch @@ -0,0 +1,38 @@ +2007-02-15 Khem Raj + + * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686. + * nptl/sysdeps/pthread/pt-initfini.c: Ditto. + + + +Index: glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h +=================================================================== +--- glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (revision 1469) ++++ glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (working copy) +@@ -29,6 +29,10 @@ + #include + #include + ++#if defined __i686 && defined __ASSEMBLER__ ++#undef __i686 ++#define __i686 __i686 ++#endif + + /* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h +Index: glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c +=================================================================== +--- glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (revision 1469) ++++ glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (working copy) +@@ -45,6 +45,11 @@ + /* Embed an #include to pull in the alignment and .end directives. */ + asm ("\n#include \"defs.h\""); + ++asm ("\n#if defined __i686 && defined __ASSEMBLER__"); ++asm ("\n#undef __i686"); ++asm ("\n#define __i686 __i686"); ++asm ("\n#endif"); ++ + /* The initial common code ends here. */ + asm ("\n/*@HEADER_ENDS*/"); + diff --git a/patches/glibc/2.5/glibc-i386-preferred-stack-boundary.patch b/patches/glibc/2.5/glibc-i386-preferred-stack-boundary.patch new file mode 100644 index 0000000..449821d --- /dev/null +++ b/patches/glibc/2.5/glibc-i386-preferred-stack-boundary.patch @@ -0,0 +1,18 @@ +(C) 2007 Yann E. MORIN +License: LGPL v2.1 + +Shut off a stupid warning: preffered-stack-boundary must be between 4 ad 12, +and 2 is not. + +diff -dur glibc-2.5.orig/sysdeps/i386/Makefile glibc-2.5/sysdeps/i386/Makefile +--- glibc-2.5.orig/sysdeps/i386/Makefile 2005-03-06 01:18:16.000000000 +0100 ++++ glibc-2.5/sysdeps/i386/Makefile 2007-05-27 17:49:37.000000000 +0200 +@@ -36,7 +36,7 @@ + ifeq ($(subdir),csu) + sysdep-CFLAGS += -mpreferred-stack-boundary=4 + else +-sysdep-CFLAGS += -mpreferred-stack-boundary=2 ++sysdep-CFLAGS += -mpreferred-stack-boundary=4 + # Likewise, any function which calls user callbacks + uses-callbacks += -mpreferred-stack-boundary=4 + # Likewise, any stack alignment tests diff --git a/patches/glibc/2.5/make-install-lib-all.patch b/patches/glibc/2.5/make-install-lib-all.patch deleted file mode 100644 index 5384da8..0000000 --- a/patches/glibc/2.5/make-install-lib-all.patch +++ /dev/null @@ -1,26 +0,0 @@ -From http://svn.exactcode.de/t2/trunk/package/base/glibc32/make-install-lib-all.patch -Rule to install all needed libraries, not just the ones installed by install-lib, -yet not install programs. -Needed because we can't use the main install target, as we can't build programs before -we have the final gcc installed; linking fails because libeh.a is not present, -and glibc insists on linking programs with that library. - -diff -Naur glibc-2.3.4.orig/Makerules glibc-2.3.4/Makerules ---- glibc-2.3.4.orig/Makerules 2004-12-15 20:52:39.000000000 +0200 -+++ glibc-2.3.4/Makerules 2005-02-19 15:16:31.415125176 +0200 -@@ -864,6 +864,13 @@ - installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\ - $(inst_libdir)/$(patsubst %,$(libtype$o),\ - $(libprefix)$(libc-name))) -+ -+install-lib-all: $(inst_slibdir)/libc.so$(libc.so-version) \ -+ $(inst_slibdir)/libc-$(version).so \ -+ $(inst_libdir)/libc.so \ -+ $(inst_libdir)/libc.a \ -+ install-lib -+ - install: $(installed-libcs) - $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force) - $(make-target-directory) - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.5/make-install-lib-all.patch.dont_apply b/patches/glibc/2.5/make-install-lib-all.patch.dont_apply new file mode 100644 index 0000000..5384da8 --- /dev/null +++ b/patches/glibc/2.5/make-install-lib-all.patch.dont_apply @@ -0,0 +1,26 @@ +From http://svn.exactcode.de/t2/trunk/package/base/glibc32/make-install-lib-all.patch +Rule to install all needed libraries, not just the ones installed by install-lib, +yet not install programs. +Needed because we can't use the main install target, as we can't build programs before +we have the final gcc installed; linking fails because libeh.a is not present, +and glibc insists on linking programs with that library. + +diff -Naur glibc-2.3.4.orig/Makerules glibc-2.3.4/Makerules +--- glibc-2.3.4.orig/Makerules 2004-12-15 20:52:39.000000000 +0200 ++++ glibc-2.3.4/Makerules 2005-02-19 15:16:31.415125176 +0200 +@@ -864,6 +864,13 @@ + installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\ + $(inst_libdir)/$(patsubst %,$(libtype$o),\ + $(libprefix)$(libc-name))) ++ ++install-lib-all: $(inst_slibdir)/libc.so$(libc.so-version) \ ++ $(inst_slibdir)/libc-$(version).so \ ++ $(inst_libdir)/libc.so \ ++ $(inst_libdir)/libc.a \ ++ install-lib ++ + install: $(installed-libcs) + $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force) + $(make-target-directory) + +Signed-off-by: Robert P. J. Day diff --git a/samples/i686-nptl-linux-gnu/crosstool.config b/samples/i686-nptl-linux-gnu/crosstool.config new file mode 100644 index 0000000..f210ccf --- /dev/null +++ b/samples/i686-nptl-linux-gnu/crosstool.config @@ -0,0 +1,294 @@ +# +# Automatically generated make config: don't edit +# crosstool-NG version: 0.0.4-svn +# Sun May 27 20:39:36 2007 +# +# CT_FOOBAR is not set + +# +# Paths and misc options +# + +# +# Crosstool behavior +# +CT_EXPERIMENTAL=y +# CT_OBSOLETE is not set +CT_DEBUG_CT=y +# CT_DEBUG_CT_PAUSE_STEPS is not set +CT_DEBUG_CT_SAVE_STEPS=y +CT_DEBUG_CT_SAVE_STEPS_GZIP=y + +# +# Build behavior +# +CT_PARALLEL_JOBS=1 +CT_LOAD=0 +CT_NICE=0 +CT_USE_PIPES=y + +# +# Paths +# +CT_LOCAL_TARBALLS_DIR="${HOME}/dev/src" +CT_PREFIX_DIR="/opt/x-tools/${CT_TARGET}" +CT_INSTALL_DIR="${CT_PREFIX_DIR}" +# CT_CUSTOM_PATCH is not set +CT_REMOVE_DOCS=y + +# +# Downloading +# +# CT_FORCE_DOWNLOAD is not set +# CT_ONLY_DOWNLOAD is not set + +# +# Extracting +# +# CT_FORCE_EXTRACT is not set +# CT_ONLY_EXTRACT is not set + +# +# Logging +# +# CT_LOG_ERROR is not set +# CT_LOG_WARN is not set +# CT_LOG_INFO is not set +CT_LOG_EXTRA=y +# CT_LOG_DEBUG is not set +# CT_LOG_ALL is not set +CT_LOG_LEVEL_MAX="EXTRA" +# CT_LOG_SEE_TOOLS_WARN is not set +CT_LOG_PROGRESS_BAR=y +CT_LOG_TO_FILE=y +CT_LOG_FILE="${CT_PREFIX_DIR}/${CT_TARGET}.log" + +# +# Target options +# + +# +# General target options +# +CT_ARCH="x86" +# CT_ARCH_ARM is not set +# CT_ARCH_MIPS is not set +CT_ARCH_x86=y +# CT_ARCH_x86_64 is not set +# CT_ARCH_SUPPORTS_BOTH_ENDIAN is not set +CT_THREADS_NPTL=y +# CT_THREADS_LINUXTHREADS is not set +# CT_THREADS_NONE is not set +CT_THREADS="nptl" + +# +# Target optimisations +# +CT_ARCH_ARCH="i686" +CT_ARCH_ABI="" +CT_ARCH_CPU="" +CT_ARCH_TUNE="i686" +CT_ARCH_FPU="" +CT_ARCH_FLOAT_HW=y +# CT_ARCH_FLOAT_SW is not set +CT_ARCH_SUPPORTS_LIBFLOAT=y +CT_TARGET_CFLAGS="" + +# +# Toolchain options +# + +# +# General toolchain options +# +CT_USE_SYSROOT=y +CT_SHARED_LIBS=y +# CT_TARGET_MULTILIB is not set +CT_TARGET_VENDOR="nptl" +CT_TARGET_ALIAS="" + +# +# Toolchain type +# +# CT_NATIVE is not set +CT_CROSS=y +# CT_CROSS_NATIVE is not set +# CT_CANADIAN is not set +CT_TOOLCHAIN_TYPE="cross" +CT_BUILD="" +CT_CC_NATIVE="gcc" + +# +# Kernel +# +CT_KERNEL_LINUX=y +CT_KERNEL_VERSION="2.6.21.3" +CT_KERNEL_LINUX_HEADERS_INSTALL=y +# CT_KERNEL_LINUX_HEADERS_SANITISED is not set +# CT_KERNEL_LINUX_HEADERS_COPY is not set +# CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR is not set +CT_KERNEL="linux" +CT_KERNEL_VERSION_SEE_EXTRAVERSION=y +# CT_KERNEL_INSTALL_V_2_6_18 is not set +# CT_KERNEL_INSTALL_V_2_6_18_1 is not set +# CT_KERNEL_INSTALL_V_2_6_18_2 is not set +# CT_KERNEL_INSTALL_V_2_6_18_3 is not set +# CT_KERNEL_INSTALL_V_2_6_18_4 is not set +# CT_KERNEL_INSTALL_V_2_6_18_5 is not set +# CT_KERNEL_INSTALL_V_2_6_18_6 is not set +# CT_KERNEL_INSTALL_V_2_6_19 is not set +# CT_KERNEL_INSTALL_V_2_6_19_1 is not set +# CT_KERNEL_INSTALL_V_2_6_19_2 is not set +# CT_KERNEL_INSTALL_V_2_6_20 is not set +# CT_KERNEL_INSTALL_V_2_6_20_1 is not set +# CT_KERNEL_INSTALL_V_2_6_20_2 is not set +# CT_KERNEL_INSTALL_V_2_6_20_3 is not set +# CT_KERNEL_INSTALL_V_2_6_20_4 is not set +# CT_KERNEL_INSTALL_V_2_6_20_5 is not set +# CT_KERNEL_INSTALL_V_2_6_20_6 is not set +# CT_KERNEL_INSTALL_V_2_6_20_7 is not set +# CT_KERNEL_INSTALL_V_2_6_21 is not set +# CT_KERNEL_INSTALL_V_2_6_21_1 is not set +# CT_KERNEL_INSTALL_V_2_6_21_2 is not set +CT_KERNEL_INSTALL_V_2_6_21_3=y +CT_KERNEL_LINUX_VERBOSITY_0=y +# CT_KERNEL_LINUX_VERBOSITY_1 is not set +# CT_KERNEL_LINUX_VERBOSITY_2 is not set +CT_KERNEL_LINUX_VERBOSE_LEVEL=0 +# CT_KERNEL_LINUX_NEEDS_CONFIG is not set + +# +# binutils +# +CT_BINUTILS_VERSION="2.17.50.0.16" +# CT_BINUTILS_V_2_11_2 is not set +# CT_BINUTILS_V_2_13_90 is not set +# CT_BINUTILS_V_2_14 is not set +# CT_BINUTILS_V_2_14_90 is not set +# CT_BINUTILS_V_2_14_92 is not set +# CT_BINUTILS_V_2_15 is not set +# CT_BINUTILS_V_2_15_90 is not set +# CT_BINUTILS_V_2_15_91 is not set +# CT_BINUTILS_V_2_16 is not set +# CT_BINUTILS_V_2_16_1 is not set +# CT_BINUTILS_V_2_17 is not set +# CT_BINUTILS_V_2_17_50_0_1 is not set +# CT_BINUTILS_V_2_17_50_0_2 is not set +# CT_BINUTILS_V_2_17_50_0_3 is not set +# CT_BINUTILS_V_2_17_50_0_4 is not set +# CT_BINUTILS_V_2_17_50_0_5 is not set +# CT_BINUTILS_V_2_17_50_0_6 is not set +# CT_BINUTILS_V_2_17_50_0_7 is not set +# CT_BINUTILS_V_2_17_50_0_8 is not set +# CT_BINUTILS_V_2_17_50_0_9 is not set +# CT_BINUTILS_V_2_17_50_0_10 is not set +# CT_BINUTILS_V_2_17_50_0_11 is not set +# CT_BINUTILS_V_2_17_50_0_12 is not set +# CT_BINUTILS_V_2_17_50_0_13 is not set +# CT_BINUTILS_V_2_17_50_0_14 is not set +# CT_BINUTILS_V_2_17_50_0_15 is not set +CT_BINUTILS_V_2_17_50_0_16=y +CT_BINUTILS_EXTRA_CONFIG="" + +# +# C compiler +# + +# +# Core C Compiler (used to build the C library) +# +# CT_CC_USE_CORE is not set + +# +# Final C compiler +# +CT_CC_GCC=y +CT_CC_VERSION="4.1.2" +CT_CC="gcc" +# CT_CC_V_2_95_3 is not set +# CT_CC_V_3_2_3 is not set +# CT_CC_V_3_3 is not set +# CT_CC_V_3_3_1 is not set +# CT_CC_V_3_3_2 is not set +# CT_CC_V_3_3_3 is not set +# CT_CC_V_3_3_4 is not set +# CT_CC_V_3_3_5 is not set +# CT_CC_V_3_3_6 is not set +# CT_CC_V_3_4_0 is not set +# CT_CC_V_3_4_1 is not set +# CT_CC_V_3_4_2 is not set +# CT_CC_V_3_4_3 is not set +# CT_CC_V_3_4_4 is not set +# CT_CC_V_3_4_5 is not set +# CT_CC_V_3_4_6 is not set +# CT_CC_V_4_0_0 is not set +# CT_CC_V_4_0_1 is not set +# CT_CC_V_4_0_2 is not set +# CT_CC_V_4_0_3 is not set +# CT_CC_V_4_0_4 is not set +# CT_CC_V_4_1_0 is not set +# CT_CC_V_4_1_1 is not set +CT_CC_V_4_1_2=y +# CT_CC_V_4_2_0 is not set +CT_CC_CXA_ATEXIT=y +CT_CC_EXTRA_CONFIG="" +CT_CC_SUPPORT_CXX=y +CT_CC_SUPPORT_FORTRAN=y +CT_CC_SUPPORT_JAVA=y +CT_CC_SUPPORT_ADA=y +CT_CC_SUPPORT_OBJC=y +CT_CC_SUPPORT_OBJCXX=y + +# +# Additionnal supported languages: +# +CT_CC_LANG_CXX=y +# CT_CC_LANG_FORTRAN is not set +# CT_CC_LANG_JAVA is not set +# CT_CC_LANG_ADA is not set +# CT_CC_LANG_OBJC is not set +# CT_CC_LANG_OBJCXX is not set +CT_CC_LANG_OTHERS="" + +# +# C-library +# +CT_LIBC_GLIBC=y +# CT_LIBC_UCLIBC is not set +CT_LIBC_VERSION="2.5" +CT_LIBC="glibc" +CT_LIBC_SUPPORT_NPTL=y +CT_LIBC_SUPPORT_LINUXTHREADS=y +# CT_LIBC_V_1_09_1 is not set +# CT_LIBC_V_2_0_1 is not set +# CT_LIBC_V_2_0_6 is not set +# CT_LIBC_V_2_1_1 is not set +# CT_LIBC_V_2_1_2 is not set +# CT_LIBC_V_2_1_3 is not set +# CT_LIBC_V_2_2 is not set +# CT_LIBC_V_2_2_1 is not set +# CT_LIBC_V_2_2_2 is not set +# CT_LIBC_V_2_2_3 is not set +# CT_LIBC_V_2_2_4 is not set +# CT_LIBC_V_2_2_5 is not set +# CT_LIBC_V_2_3 is not set +# CT_LIBC_V_2_3_1 is not set +# CT_LIBC_V_2_3_2 is not set +# CT_LIBC_V_2_3_3 is not set +# CT_LIBC_V_2_3_4 is not set +# CT_LIBC_V_2_3_5 is not set +# CT_LIBC_V_2_3_6 is not set +# CT_LIBC_V_2_4 is not set +CT_LIBC_V_2_5=y +CT_LIBC_GLIBC_EXTRA_CONFIG="" +CT_LIBC_GLIBC_EXTRA_CFLAGS="" +CT_LIBC_EXTRA_CC_ARGS="" +CT_LIBC_GLIBC_CONFIGPARMS="" +# CT_LIBC_GLIBC_USE_PORTS is not set +# CT_LIBC_ADDONS is not set + +# +# Debug facilities +# +# CT_DMALLOC is not set +# CT_GDB is not set diff --git a/scripts/build/binutils.sh b/scripts/build/binutils.sh index 3dec3ca..7615963 100644 --- a/scripts/build/binutils.sh +++ b/scripts/build/binutils.sh @@ -39,14 +39,18 @@ do_binutils() { CT_DoLog EXTRA "Installing binutils" make install 2>&1 |CT_DoLog ALL - # Make those new tools available to the core C compiler to come: + # Make those new tools available to the core C compilers to come: # Note: some components want the ${TARGET}-{ar,as,ld,strip} commands as # well. Create that (libfloat is one such sucker). - mkdir -p "${CT_CC_CORE_PREFIX_DIR}/${CT_TARGET}/bin" - mkdir -p "${CT_CC_CORE_PREFIX_DIR}/bin" + mkdir -p "${CT_CC_CORE_STATIC_PREFIX_DIR}/${CT_TARGET}/bin" + mkdir -p "${CT_CC_CORE_STATIC_PREFIX_DIR}/bin" + mkdir -p "${CT_CC_CORE_SHARED_PREFIX_DIR}/${CT_TARGET}/bin" + mkdir -p "${CT_CC_CORE_SHARED_PREFIX_DIR}/bin" for t in ar as ld strip; do - ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_PREFIX_DIR}/${CT_TARGET}/bin/${t}" - ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_PREFIX_DIR}/bin/${CT_TARGET}-${t}" + ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_STATIC_PREFIX_DIR}/${CT_TARGET}/bin/${t}" + ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_STATIC_PREFIX_DIR}/bin/${CT_TARGET}-${t}" + ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_SHARED_PREFIX_DIR}/${CT_TARGET}/bin/${t}" + ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_SHARED_PREFIX_DIR}/bin/${CT_TARGET}-${t}" done |CT_DoLog ALL CT_EndStep diff --git a/scripts/build/cc_core_gcc.sh b/scripts/build/cc_core_gcc.sh index af6b744..20f1240 100644 --- a/scripts/build/cc_core_gcc.sh +++ b/scripts/build/cc_core_gcc.sh @@ -21,27 +21,47 @@ do_cc_core_extract() { CT_ExtractAndPatch "${CT_CC_CORE_FILE}" } -# Build core gcc -do_cc_core() { - mkdir -p "${CT_BUILD_DIR}/build-cc-core" - cd "${CT_BUILD_DIR}/build-cc-core" +# Core gcc pass 1 +do_cc_core_pass_1() { + # In case we're NPTL, build the static core gcc; + # in any other case, do nothing. + case "${CT_THREADS}" in + nptl) do_cc_core_static;; + *) ;; + esac +} + +# Core gcc pass 2 +do_cc_core_pass_2() { + # In case we're NPTL, build the shared core gcc, + # in any other case, build the static core gcc. + case "${CT_THREADS}" in + nptl) do_cc_core_shared;; + *) do_cc_core_static;; + esac +} + +# Build static core gcc +do_cc_core_static() { + mkdir -p "${CT_BUILD_DIR}/build-cc-core-static" + cd "${CT_BUILD_DIR}/build-cc-core-static" - CT_DoStep INFO "Installing core C compiler" + CT_DoStep INFO "Installing static core C compiler" CT_DoLog EXTRA "Copying headers to install area of bootstrap gcc, so it can build libgcc2" - mkdir -p "${CT_CC_CORE_PREFIX_DIR}/${CT_TARGET}/include" - cp -r "${CT_HEADERS_DIR}"/* "${CT_CC_CORE_PREFIX_DIR}/${CT_TARGET}/include" 2>&1 |CT_DoLog DEBUG + mkdir -p "${CT_CC_CORE_STATIC_PREFIX_DIR}/${CT_TARGET}/include" + cp -r "${CT_HEADERS_DIR}"/* "${CT_CC_CORE_STATIC_PREFIX_DIR}/${CT_TARGET}/include" 2>&1 |CT_DoLog DEBUG - CT_DoLog EXTRA "Configuring core C compiler" + CT_DoLog EXTRA "Configuring static core C compiler" extra_config="" [ "${CT_ARCH_FLOAT_SW}" = "y" ] && extra_config="${extra_config} --with-float=soft" [ -n "${CT_ARCH_ABI}" ] && extra_config="${extra_config} --with-abi=${CT_ARCH_ABI}" + [ -n "${CT_ARCH_ARCH}" ] && extra_config="${extra_config} --with-arch=${CT_ARCH_ARCH}" [ -n "${CT_ARCH_CPU}" ] && extra_config="${extra_config} --with-cpu=${CT_ARCH_CPU}" [ -n "${CT_ARCH_TUNE}" ] && extra_config="${extra_config} --with-tune=${CT_ARCH_TUNE}" - [ -n "${CT_ARCH_ARCH}" ] && extra_config="${extra_config} --with-arch=${CT_ARCH_ARCH}" [ -n "${CT_ARCH_FPU}" ] && extra_config="${extra_config} --with-fpu=${CT_ARCH_FPU}" - [ "${CT_CC_CXA_ATEXIT}" == "y" ] && extra_config="${extra_config} --enable-__cxa_atexit" + [ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit" CT_DoLog DEBUG "Extra config passed: \"${extra_config}\"" @@ -49,9 +69,9 @@ do_cc_core() { CFLAGS="${CT_CFLAGS_FOR_HOST}" \ "${CT_SRC_DIR}/${CT_CC_CORE_FILE}/configure" \ ${CT_CANADIAN_OPT} \ - --target=${CT_TARGET} \ --host=${CT_HOST} \ - --prefix="${CT_CC_CORE_PREFIX_DIR}" \ + --target=${CT_TARGET} \ + --prefix="${CT_CC_CORE_STATIC_PREFIX_DIR}" \ --with-local-prefix="${CT_SYSROOT_DIR}" \ --disable-multilib \ --with-newlib \ @@ -69,12 +89,102 @@ do_cc_core() { make ${PARALLELMFLAGS} all-build-libiberty 2>&1 |CT_DoLog ALL fi - CT_DoLog EXTRA "Building core C compiler" + CT_DoLog EXTRA "Building static core C compiler" make ${PARALLELMFLAGS} all-gcc 2>&1 |CT_DoLog ALL - CT_DoLog EXTRA "Installing core C compiler" + CT_DoLog EXTRA "Installing static core C compiler" make install-gcc 2>&1 |CT_DoLog ALL CT_EndStep } +# Build shared core gcc +do_cc_core_shared() { + mkdir -p "${CT_BUILD_DIR}/build-cc-core-shared" + cd "${CT_BUILD_DIR}/build-cc-core-shared" + + CT_DoStep INFO "Installing shared core C compiler" + + CT_DoLog EXTRA "Copying headers to install area of bootstrap gcc, so it can build libgcc2" + mkdir -p "${CT_CC_CORE_SHARED_PREFIX_DIR}/${CT_TARGET}/include" + cp -r "${CT_HEADERS_DIR}"/* "${CT_CC_CORE_SHARED_PREFIX_DIR}/${CT_TARGET}/include" 2>&1 |CT_DoLog DEBUG + + CT_DoLog EXTRA "Configuring shared core C compiler" + + extra_config="" + [ "${CT_ARCH_FLOAT_SW}" = "y" ] && extra_config="${extra_config} --with-float=soft" + [ -n "${CT_ARCH_ABI}" ] && extra_config="${extra_config} --with-abi=${CT_ARCH_ABI}" + [ -n "${CT_ARCH_ARCH}" ] && extra_config="${extra_config} --with-arch=${CT_ARCH_ARCH}" + [ -n "${CT_ARCH_CPU}" ] && extra_config="${extra_config} --with-cpu=${CT_ARCH_CPU}" + [ -n "${CT_ARCH_TUNE}" ] && extra_config="${extra_config} --with-tune=${CT_ARCH_TUNE}" + [ -n "${CT_ARCH_FPU}" ] && extra_config="${extra_config} --with-fpu=${CT_ARCH_FPU}" + [ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit" + + CT_DoLog DEBUG "Extra config passed: \"${extra_config}\"" + + CFLAGS="${CT_CFLAGS_FOR_HOST}" \ + "${CT_SRC_DIR}/${CT_CC_CORE_FILE}/configure" \ + ${CT_CANADIAN_OPT} \ + --target=${CT_TARGET} \ + --host=${CT_HOST} \ + --prefix="${CT_CC_CORE_SHARED_PREFIX_DIR}" \ + --with-local-prefix="${CT_SYSROOT_DIR}" \ + --disable-multilib \ + ${CC_CORE_SYSROOT_ARG} \ + ${extra_config} \ + --disable-nls \ + --enable-symvers=gnu \ + --enable-languages=c \ + --enable-shared \ + ${CT_CC_CORE_EXTRA_CONFIG} 2>&1 |CT_DoLog ALL + + # HACK: we need to override SHLIB_LC from gcc/config/t-slibgcc-elf-ver or + # gcc/config/t-libunwind so -lc is removed from the link for + # libgcc_s.so, as we do not have a target -lc yet. + # This is not as ugly as it appears to be ;-) All symbols get resolved + # during the glibc build, and we provide a proper libgcc_s.so for the + # cross toolchain during the final gcc build. + # + # As we cannot modify the source tree, nor override SHLIB_LC itself + # during configure or make, we have to edit the resultant + # gcc/libgcc.mk itself to remove -lc from the link. + # This causes us to have to jump through some hoops... + # + # To produce libgcc.mk to edit we firstly require libiberty.a, + # so we configure then build it. + # Next we have to configure gcc, create libgcc.mk then edit it... + # So much easier if we just edit the source tree, but hey... + if [ ! -f "${CT_SRC_DIR}/${CT_CC_CORE_FILE}/gcc/BASE-VER" ]; then + make configure-libiberty + make -C libiberty libiberty.a + make configure-gcc + make configure-libcpp + make all-libcpp + else + make configure-gcc + make configure-libcpp + make configure-build-libiberty + make all-libcpp + make all-build-libiberty + fi 2>&1 |CT_DoLog ALL + # HACK: gcc-4.2 uses libdecnumber to build libgcc.mk, so build it here. + if [ -d "${CT_SRC_DIR}/${CT_CC_CORE_FILE}/libdecnumber" ]; then + make configure-libdecnumber + make -C libdecnumber libdecnumber.a + fi 2>&1 |CT_DoLog ALL + make -C gcc libgcc.mk 2>&1 |CT_DoLog ALL + sed -r -i -e 's@-lc@@g' gcc/libgcc.mk + + if [ "${CT_CANADIAN}" = "y" ]; then + CT_DoLog EXTRA "Building libiberty" + make ${PARALLELMFLAGS} all-build-libiberty 2>&1 |CT_DoLog ALL + fi + + CT_DoLog EXTRA "Building shared core C compiler" + make ${PARALLELMFLAGS} all-gcc 2>&1 |CT_DoLog ALL + + CT_DoLog EXTRA "Installing shared core C compiler" + make install-gcc 2>&1 |CT_DoLog ALL + + CT_EndStep +} diff --git a/scripts/build/debug/dmalloc.sh b/scripts/build/debug/dmalloc.sh index e9bc0da..075035c 100644 --- a/scripts/build/debug/dmalloc.sh +++ b/scripts/build/debug/dmalloc.sh @@ -22,7 +22,7 @@ do_debug_dmalloc_build() { y) extra_config="${extra_config} --enable-cxx";; *) extra_config="${extra_config} --disable-cxx";; esac - case "${CT_LIBC_THREADS_NONE}" in + case "${CT_THREADS_NONE}" in y) extra_config="${extra_config} --disable-threads";; *) extra_config="${extra_config} --enable-threads";; esac diff --git a/scripts/build/libc_glibc.sh b/scripts/build/libc_glibc.sh index 41be59a..36f1ba2 100644 --- a/scripts/build/libc_glibc.sh +++ b/scripts/build/libc_glibc.sh @@ -11,10 +11,13 @@ do_libc_get() { # C library addons addons_list=`echo "${CT_LIBC_ADDONS_LIST}" |sed -r -e 's/,/ /g; s/ $//g;'` + case "${CT_THREADS}" in + linuxthreads) addons_list="${addons_list} linuxthreads";; + esac + [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list} ports" for addon in ${addons_list}; do CT_GetFile "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" ftp://ftp.gnu.org/gnu/glibc done - [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && CT_GetFile "${CT_LIBC}-ports-${CT_LIBC_VERSION}" ftp://ftp.gnu.org/gnu/glibc return 0 } @@ -25,10 +28,13 @@ do_libc_extract() { # C library addons addons_list=`echo "${CT_LIBC_ADDONS_LIST}" |sed -r -e 's/,/ /g; s/ $//g;'` + case "${CT_THREADS}" in + linuxthreads) addons_list="${addons_list} linuxthreads";; + esac + [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list} ports" for addon in ${addons_list}; do CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" done - [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && CT_ExtractAndPatch "${CT_LIBC}-ports-${CT_LIBC_VERSION}" return 0 } @@ -68,21 +74,27 @@ do_libc_headers() { # 'a version of binutils that supports .machine "altivec" is needed'. # We also need to use the ports addon if specified - addons= - [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons="${CT_LIBC}-ports-${CT_LIBC_VERSION}" + addons_list= + case "${CT_LIBC_ADDONS},${CT_LIBC_GLIBC_USE_PORTS}" in + y,y) addons_list="${CT_LIBC_ADDONS_LIST},ports";; + y,) addons_list="${CT_LIBC_ADDONS_LIST}";; + ,y) addons_list="ports";; + *) addons_list="";; + esac + addons_config="--enable-add-ons=`echo ${addons_list} |sed -r -e 's/,+/,/g; s/^,+//; s/,+$//;'`" libc_cv_ppc_machine=yes \ CC=${CT_CC_NATIVE} \ "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \ - --build="${CT_BUILD}" \ + --build="${CT_UNIQ_BUILD}" \ --host="${CT_TARGET}" \ --prefix=/usr \ --with-headers="${CT_HEADERS_DIR}" \ --without-cvs \ --disable-sanity-checks \ --enable-hacker-mode \ - --enable-add-ons="${addons}" \ - --without-nptl 2>&1 |CT_DoLog ALL + --without-nptl \ + ${addons_config} 2>&1 |CT_DoLog ALL CT_DoLog EXTRA "Installing C library headers" @@ -133,15 +145,40 @@ do_libc_headers() { # but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html [ "${CT_ARCH}" != "arm" ] && cp misc/syscall-list.h "${CT_HEADERS_DIR}/bits/syscall.h" || true + # Those headers are to be manually copied so gcc can build properly + pthread_h= + pthreadtypes_h= + case "${CT_THREADS}" in + nptl) + # NOTE: for some archs, the pathes are different, but they are not + # supported by ct-ng right now. See original crosstool when they are. + pthread_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_THREADS}/sysdeps/pthread/pthread.h" + pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h" + ;; + linuxthreads) + pthread_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_THREADS}/sysdeps/pthread/pthread.h" + pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h" + ;; + esac + if [ -n "${pthread_h}" ]; then + cp -v "${pthread_h}" "${CT_HEADERS_DIR}/pthread.h" 2>&1 |CT_DoLog ALL + fi + if [ -n "${pthreadtypes_h}" ]; then + cp -v "${pthreadtypes_h}" "${CT_HEADERS_DIR}/bits/pthreadtypes.h" 2>&1 |CT_DoLog ALL + fi + CT_EndStep } -# This function builds and install the full glibc -do_libc() { - CT_DoStep INFO "Installing C library" +# Build and install start files +do_libc_start_files() { + # Needed only in the NPTL case. Otherwise, return. + [ "${CT_THREADS}" = "nptl" ] || return 0 - mkdir -p "${CT_BUILD_DIR}/build-libc" - cd "${CT_BUILD_DIR}/build-libc" + CT_DoStep INFO "Installing C library start files" + + mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles" + cd "${CT_BUILD_DIR}/build-libc-startfiles" CT_DoLog EXTRA "Configuring C library" @@ -153,31 +190,32 @@ do_libc() { esac case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in *-tls*) ;; - *) extra_config="${extra_config} --without-tls" - esac - case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in - *-__thread*) ;; - *) extra_config="${extra_config} --without-__thread" + *) extra_config="${extra_config} --with-tls" esac case "${CT_SHARED_LIBS}" in y) extra_config="${extra_config} --enable-shared";; *) extra_config="${extra_config} --disable-shared";; esac case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in - *--with-fp*) ;; - *--without-fp*) ;; - *) case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in + *--with-fp*) ;; + *--without-fp*) ;; + *) case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in y,) extra_config="${extra_config} --with-fp";; ,y) extra_config="${extra_config} --without-fp";; esac;; esac + # Obviously, we want threads, as we come here only for NPTL + extra_config="${extra_config} --with-__thread" + addons_list= case "${CT_LIBC_ADDONS},${CT_LIBC_GLIBC_USE_PORTS}" in - y,y) addons_config="--enable-add-ons=${CT_LIBC_ADDONS_LIST},${CT_LIBC}-ports-${CT_LIBC_VERSION}";; - y,) addons_config="--enable-add-ons=${CT_LIBC_ADDONS_LIST}";; - ,y) addons_config="--enable-add-ons=${CT_LIBC}-ports-${CT_LIBC_VERSION}";; - *) addons_config="";; + y,y) addons_list="nptl,${CT_LIBC_ADDONS_LIST},ports";; + y,) addons_list="nptl,${CT_LIBC_ADDONS_LIST}";; + ,y) addons_list="nptl,ports";; + *) addons_list="nptl";; esac + addons_config="--enable-add-ons=`echo ${addons_list} |sed -r -e 's/,+/,/g; s/^,+//; s/,+$//;'`" + extra_config="${extra_config} ${addons_config}" # Add some default CC args extra_cc_args="${CT_CFLAGS_FOR_HOST}" @@ -190,7 +228,114 @@ do_libc() { esac;; esac - CT_DoLog DEBUG "Configuring with addons : \"${addons_config}\"" + CT_DoLog DEBUG "Configuring with addons : \"${addons_list}\"" + CT_DoLog DEBUG "Extra config args passed: \"${extra_config}\"" + CT_DoLog DEBUG "Extra CC args passed: \"${extra_cc_args}\"" + + # sh3 and sh4 really need to set configparms as of gcc-3.4/glibc-2.3.2 + # note: this is awkward, doesn't work well if you need more than one line in configparms + echo ${CT_LIBC_GLIBC_CONFIGPARMS} > configparms + + echo "libc_cv_forced_unwind=yes" > config.cache + echo "libc_cv_c_cleanup=yes" >> config.cache + + # Please see the comment for the configure step in do_libc(). + + BUILD_CC=${CT_CC_NATIVE} \ + CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O" \ + CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \ + AR=${CT_TARGET}-ar \ + RANLIB=${CT_TARGET}-ranlib \ + "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \ + --prefix=/usr \ + --build="${CT_UNIQ_BUILD}" \ + --host=${CT_TARGET} \ + --without-cvs \ + --disable-profile \ + --disable-debug \ + --without-gd \ + --with-headers="${CT_HEADERS_DIR}" \ + --cache-file=config.cache \ + ${extra_config} \ + ${CT_LIBC_GLIBC_EXTRA_CONFIG} 2>&1 |CT_DoLog ALL + + + #TODO: should check whether slibdir has been set in configparms to */lib64 + # and copy the startfiles into the appropriate libdir. + make csu/subdir_lib 2>&1 |CT_DoLog ALL + + if [ "${CT_USE_SYSROOT}" = "y" ]; then + cp -fp csu/crt[1in].o "${CT_SYSROOT_DIR}/usr/lib/" + else + cp -fp csu/crt[1in].o "${CT_SYSROOT_DIR}/lib/" + fi + + CT_EndStep +} + +# This function builds and install the full glibc +do_libc() { + CT_DoStep INFO "Installing C library" + + mkdir -p "${CT_BUILD_DIR}/build-libc" + cd "${CT_BUILD_DIR}/build-libc" + + CT_DoLog EXTRA "Configuring C library" + + # Add some default glibc config options if not given by user. + # We don't need to be conditional on wether the user did set different + # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config + + extra_config="--enable-kernel=`echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;'`" + + case "${CT_THREADS}" in + nptl) extra_config="${extra_config} --with-__thread --with-tls";; + linuxthreads) extra_config="${extra_config} --with-__thread --without-tls --without-nptl";; + none) extra_config="${extra_config} --without-__thread --without-nptl" + case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in + *-tls*) ;; + *) extra_config="${extra_config} --without-tls";; + esac + ;; + esac + + case "${CT_SHARED_LIBS}" in + y) extra_config="${extra_config} --enable-shared";; + *) extra_config="${extra_config} --disable-shared";; + esac + + case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in + y,) extra_config="${extra_config} --with-fp";; + ,y) extra_config="${extra_config} --without-fp";; + esac + + addons_list= + case "${CT_LIBC_ADDONS},${CT_LIBC_GLIBC_USE_PORTS}" in + y,y) addons_list="${CT_LIBC_ADDONS_LIST},ports";; + y,) addons_list="${CT_LIBC_ADDONS_LIST}";; + ,y) addons_list="ports";; + *) addons_list="";; + esac + case "${CT_THREADS}" in + none) ;; + *) addons_list="${addons_list},${CT_THREADS}";; + esac + case "${addons_list}" in + "") ;; + *) addons_config="--enable-add-ons=`echo ${addons_list} |sed -r -e 's/,+/,/g; s/^,+//g; s/,+$//;'`";; + esac + extra_config="${extra_config} ${addons_config}" + + # Add some default CC args + if [ "${CT_USE_PIPES}" = "y" ]; then + extra_cc_args="-pipe" + fi + case "${CT_ARCH_BE},${CT_ARCH_LE}" in + y,) extra_cc_args="${extra_cc_args} -mbig-endian";; + ,y) extra_cc_args="${extra_cc_args} -mlittle-endian";; + esac + + CT_DoLog DEBUG "Configuring with addons : \"${addons_list}\"" CT_DoLog DEBUG "Extra config args passed: \"${extra_config}\"" CT_DoLog DEBUG "Extra CC args passed: \"${extra_cc_args}\"" @@ -201,11 +346,10 @@ do_libc() { # For glibc 2.3.4 and later we need to set some autoconf cache # variables, because nptl/sysdeps/pthread/configure.in does not # work when cross-compiling. - if test -d ${GLIBC_DIR}/nptl; then - libc_cv_forced_unwind=yes - libc_cv_c_cleanup=yes - export libc_cv_forced_unwind libc_cv_c_cleanup - fi + if [ "${CT_THREADS}" = "nptl" ]; then + echo libc_cv_forced_unwind=yes + echo libc_cv_c_cleanup=yes + fi >config.cache # Configure with --prefix the way we want it on the target... # There are a whole lot of settings here. You'll probably want @@ -216,19 +360,26 @@ do_libc() { # Set BUILD_CC, or you won't be able to build datafiles # Set --build, else glibc-2.3.2 will think you're not cross-compiling, and try to run the test programs + # OK. I'm fed up with those folks telling me what I should do. + # I don't configure nptl? Well, maybe that's purposedly because + # I don't want nptl! --disable-sanity-checks will shut up those + # silly messages. GNU folks again, he? + BUILD_CC=${CT_CC_NATIVE} \ CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O" \ - CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \ + CC="${CT_TARGET}-gcc ${extra_cc_args} ${CT_LIBC_EXTRA_CC_ARGS}" \ AR=${CT_TARGET}-ar \ RANLIB=${CT_TARGET}-ranlib \ "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \ --prefix=/usr \ - --build=${CT_BUILD} --host=${CT_TARGET} \ + --build=${CT_UNIQ_BUILD} \ + --host=${CT_TARGET} \ --without-cvs \ - --without-nptl \ --disable-profile \ --disable-debug \ --without-gd \ + --disable-sanity-checks \ + --cache-file=config.cache \ --with-headers="${CT_HEADERS_DIR}" \ ${addons_config} \ ${extra_config} \ diff --git a/scripts/build/libc_uClibc.sh b/scripts/build/libc_uClibc.sh index a8fb9be..632db69 100644 --- a/scripts/build/libc_uClibc.sh +++ b/scripts/build/libc_uClibc.sh @@ -79,6 +79,11 @@ do_libc_headers() { CT_EndStep } +# Build and install start files +do_libc_start_files() { + : +} + # This function build and install the full uClibc do_libc() { CT_DoStep INFO "Installing C library" diff --git a/scripts/build/libfloat.sh b/scripts/build/libfloat.sh index b557404..147d046 100644 --- a/scripts/build/libfloat.sh +++ b/scripts/build/libfloat.sh @@ -40,11 +40,11 @@ do_libfloat() { make clean 2>&1 |CT_DoLog ALL CT_DoLog EXTRA "Building library" - make CROSS_COMPILE="${CT_CC_CORE_PREFIX_DIR}/bin/${CT_TARGET}-" 2>&1 |CT_DoLog ALL + make CROSS_COMPILE="${CT_CC_CORE_SHARED_PREFIX_DIR}/bin/${CT_TARGET}-" 2>&1 |CT_DoLog ALL CT_DoLog EXTRA "Installing library" - make CROSS_COMPILE="${CT_CC_CORE_PREFIX_DIR}/bin/${CT_TARGET}-" \ - DESTDIR="${CT_SYSROOT_DIR}" install 2>&1 |CT_DoLog ALL + make CROSS_COMPILE="${CT_CC_CORE_SHARED_PREFIX_DIR}/bin/${CT_TARGET}-" \ + DESTDIR="${CT_SYSROOT_DIR}" install 2>&1 |CT_DoLog ALL CT_Popd diff --git a/scripts/crosstool.sh b/scripts/crosstool.sh index 8c78e57..80f938f 100755 --- a/scripts/crosstool.sh +++ b/scripts/crosstool.sh @@ -31,7 +31,7 @@ CT_STAR_DATE_HUMAN=`CT_DoDate +%Y%m%d.%H%M%S` # - first of all, save stdout so we can see the live logs: fd #6 exec 6>&1 # - then point stdout to the log file (temporary for now) -tmp_log_file="${CT_TOP_DIR}/$$.log" +tmp_log_file="${CT_TOP_DIR}/log.$$" exec >>"${tmp_log_file}" # Are we configured? We'll need that later... @@ -118,7 +118,8 @@ CT_DEBUG_INSTALL_DIR="${CT_INSTALL_DIR}/${CT_TARGET}/debug-root" # Note: we'll always install the core compiler in its own directory, so as to # not mix the two builds: core and final. Anyway, its generic, wether we use # a different compiler as core, or not. -CT_CC_CORE_PREFIX_DIR="${CT_BUILD_DIR}/${CT_CC}-core" +CT_CC_CORE_STATIC_PREFIX_DIR="${CT_BUILD_DIR}/${CT_CC}-core-static" +CT_CC_CORE_SHARED_PREFIX_DIR="${CT_BUILD_DIR}/${CT_CC}-core-shared" CT_STATE_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/state" # Make all path absolute, it so much easier! @@ -201,11 +202,12 @@ mkdir -p "${CT_BUILD_DIR}" mkdir -p "${CT_INSTALL_DIR}" mkdir -p "${CT_PREFIX_DIR}" mkdir -p "${CT_DEBUG_INSTALL_DIR}" -mkdir -p "${CT_CC_CORE_PREFIX_DIR}" +mkdir -p "${CT_CC_CORE_STATIC_PREFIX_DIR}" +mkdir -p "${CT_CC_CORE_SHARED_PREFIX_DIR}" mkdir -p "${CT_STATE_DIR}" # Kludge: CT_INSTALL_DIR and CT_PREFIX_DIR might have grown read-only if -# the previous build was successfull. To ba able to move the logfile there, +# the previous build was successfull. To be able to move the logfile there, # switch them back to read/write chmod -R u+w "${CT_INSTALL_DIR}" "${CT_PREFIX_DIR}" @@ -269,16 +271,22 @@ if [ -z "${CT_RESTART}" ]; then mkdir -p "${CT_SYSROOT_DIR}/usr/lib" # Canadian-cross are really picky on the way they are built. Tweak the values. + CT_UNIQ_BUILD=`echo "${CT_BUILD}" |sed -r -e 's/-/-build_/'` if [ "${CT_CANADIAN}" = "y" ]; then # Arrange so that gcc never, ever think that build system == host system - CT_CANADIAN_OPT="--build=`echo \"${CT_BUILD}\" |sed -r -e 's/-/-build_/'`" + CT_CANADIAN_OPT="--build=${CT_UNIQ_BUILD}" # We shall have a compiler for this target! # Do test here... else CT_HOST="${CT_BUILD}" CT_CANADIAN_OPT="--build=${CT_BUILD}" # Add the target toolchain in the path so that we can build the C library - export PATH="${CT_PREFIX_DIR}/bin:${CT_CC_CORE_PREFIX_DIR}/bin:${PATH}" + # Carefully add paths in the order we want them: + # - first try in ${CT_PREFIX_DIR}/bin + # - then try in ${CT_CC_CORE_SHARED_PREFIX_DIR}/bin + # - then try in ${CT_CC_CORE_STATIC_PREFIX_DIR}/bin + # - fall back to searching user's PATH + export PATH="${CT_PREFIX_DIR}/bin:${CT_CC_CORE_SHARED_PREFIX_DIR}/bin:${CT_CC_CORE_STATIC_PREFIX_DIR}/bin:${PATH}" fi # Modify GCC_HOST to never be equal to $BUILD or $TARGET @@ -294,7 +302,7 @@ if [ -z "${CT_RESTART}" ]; then # (Copied almost as-is from original crosstool): case "${CT_KERNEL},${CT_CANADIAN}" in cygwin,y) ;; - *) CT_HOST="`echo \"${CT_HOST}\" |sed -r -e 's/-/-host_/;'`";; + *,y) CT_HOST="`echo \"${CT_HOST}\" |sed -r -e 's/-/-host_/;'`";; esac # Ah! Recent versions of binutils need some of the build and/or host system @@ -304,10 +312,9 @@ if [ -z "${CT_RESTART}" ]; then mkdir -p "${CT_PREFIX_DIR}/bin" for tool in ar as dlltool gcc g++ gnatbind gnatmake ld nm ranlib strip windres objcopy objdump; do if [ -n "`which ${tool}`" ]; then - ln -sv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}" - case "${CT_TOOLCHAIN_TYPE}" in - cross|native) ln -sv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_HOST}-${tool}";; - esac + ln -sfv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}" + ln -sfv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_UNIQ_BUILD}-${tool}" + ln -sfv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_HOST}-${tool}" fi |CT_DoLog DEBUG done @@ -392,8 +399,10 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" -a "${CT_ONLY_EXTRACT}" != "y" ]; then kernel_check_config \ kernel_headers \ binutils \ + cc_core_pass_1 \ libc_headers \ - cc_core \ + libc_start_files \ + cc_core_pass_2 \ libfloat \ libc \ cc \ diff --git a/scripts/functions b/scripts/functions index dcf4160..ce4c001 100644 --- a/scripts/functions +++ b/scripts/functions @@ -2,6 +2,7 @@ # Copyright 2007 Yann E. MORIN # Licensed under the GPL v2. See COPYING in the root of this package +# Prepare the fault handler CT_OnError() { ret=$? CT_DoLog ERROR "Build failed in step \"${CT_STEP_MESSAGE[${CT_STEP_COUNT}]}\"" @@ -17,11 +18,23 @@ CT_OnError() { CT_DoEnd ERROR exit $ret } + +# Install the fault handler trap CT_OnError ERR +# Inherit the fault handler in subshells and functions set -E + +# Make pipes fail on the _first_ failed command +# Not supported on bash < 3.x, but we need it, so drop the obsoleting bash-2.x set -o pipefail +# Don't hash commands' locations, and search every time it is requested. +# This is slow, but needed because of the static/shared core gcc which shall +# always match to shared if it exists, and only fallback to static if the +# shared is not found +set +o hashall + # The different log levels: CT_LOG_LEVEL_ERROR=0 CT_LOG_LEVEL_WARN=1 @@ -392,8 +405,16 @@ CT_ExtractAndPatch() { # a libc addon, or a plain package. Apply patches now. CT_DoLog EXTRA "Patching \"${file}\"" - # If libc addon, we're already in the correct place. - [ -z "${libc_addon}" ] && cd "${file}" + if [ "${libc_addon}" = "y" ]; then + # Some addons tarball directly contian the correct addon directory, + # while others have the addon directory named ofter the tarball. + # Fix that bu always using the short name (eg: linuxthreads, ports, etc...) + addon_short_name=`echo "${file}" |sed -r -e 's/^[^-]+-//; s/-[^-]+$//;'` + [ -d "${addon_short_name}" ] || ln -s "${file}" "${addon_short_name}" + # If libc addon, we're already in the correct place + else + cd "${file}" + fi [ "${CUSTOM_PATCH_ONLY}" = "y" ] || official_patch_dir="${CT_TOP_DIR}/patches/${base_file}/${ver_file}" [ "${CT_CUSTOM_PATCH}" = "y" ] && custom_patch_dir="${CT_CUSTOM_PATCH_DIR}/${base_file}/${ver_file}" @@ -493,14 +514,19 @@ CT_DoSaveState() { $0 == "}" { _p = 1; } ' |egrep -v '^[^ ]+ \(\)' >"${state_dir}/env.sh" - CT_DoLog DEBUG " Saving CT_CC_CORE_PREFIX_DIR=\"${CT_CC_CORE_PREFIX_DIR}\"" - CT_Pushd "${CT_CC_CORE_PREFIX_DIR}" - tar ${tar_opt} "${state_dir}/cc_core_prefix_dir${tar_ext}" . + CT_DoLog DEBUG " Saving CT_CC_CORE_STATIC_PREFIX_DIR=\"${CT_CC_CORE_STATIC_PREFIX_DIR}\"" + CT_Pushd "${CT_CC_CORE_STATIC_PREFIX_DIR}" + tar ${tar_opt} "${state_dir}/cc_core_static_prefix_dir${tar_ext}" . + CT_Popd + + CT_DoLog DEBUG " Saving CT_CC_CORE_SHARED_PREFIX_DIR=\"${CT_CC_CORE_SHARED_PREFIX_DIR}\"" + CT_Pushd "${CT_CC_CORE_SHARED_PREFIX_DIR}" + tar ${tar_opt} "${state_dir}/cc_core_shared_prefix_dir${tar_ext}" . CT_Popd CT_DoLog DEBUG " Saving CT_PREFIX_DIR=\"${CT_PREFIX_DIR}\"" CT_Pushd "${CT_PREFIX_DIR}" - tar ${tar_opt} "${state_dir}/prefix_dir${tar_ext}" . + tar ${tar_opt} "${state_dir}/prefix_dir${tar_ext}" --exclude '*.log' . CT_Popd if [ "${CT_LOG_TO_FILE}" = "y" ]; then @@ -514,7 +540,7 @@ CT_DoSaveState() { fi } -# This functions restores a previously saved state +# This function restores a previously saved state # Usage: CT_DoLoadState CT_DoLoadState(){ local state_name="$1" @@ -534,18 +560,23 @@ CT_DoLoadState(){ esac CT_DoLog DEBUG " Removing previous build directories" - chmod -R u+rwX "${CT_PREFIX_DIR}" "${CT_CC_CORE_PREFIX_DIR}" - rm -rf "${CT_PREFIX_DIR}" "${CT_CC_CORE_PREFIX_DIR}" - mkdir -p "${CT_PREFIX_DIR}" "${CT_CC_CORE_PREFIX_DIR}" + chmod -R u+rwX "${CT_PREFIX_DIR}" "${CT_CC_CORE_SHARED_PREFIX_DIR}" "${CT_CC_CORE_STATIC_PREFIX_DIR}" + rm -rf "${CT_PREFIX_DIR}" "${CT_CC_CORE_SHARED_PREFIX_DIR}" "${CT_CC_CORE_STATIC_PREFIX_DIR}" + mkdir -p "${CT_PREFIX_DIR}" "${CT_CC_CORE_SHARED_PREFIX_DIR}" "${CT_CC_CORE_STATIC_PREFIX_DIR}" CT_DoLog DEBUG " Restoring CT_PREFIX_DIR=\"${CT_PREFIX_DIR}\"" CT_Pushd "${CT_PREFIX_DIR}" tar ${tar_opt} "${state_dir}/prefix_dir${tar_ext}" CT_Popd - CT_DoLog DEBUG " Restoring CT_CC_CORE_PREFIX_DIR=\"${CT_CC_CORE_PREFIX_DIR}\"" - CT_Pushd "${CT_CC_CORE_PREFIX_DIR}" - tar ${tar_opt} "${state_dir}/cc_core_prefix_dir${tar_ext}" + CT_DoLog DEBUG " Restoring CT_CC_CORE_SHARED_PREFIX_DIR=\"${CT_CC_CORE_SHARED_PREFIX_DIR}\"" + CT_Pushd "${CT_CC_CORE_SHARED_PREFIX_DIR}" + tar ${tar_opt} "${state_dir}/cc_core_shared_prefix_dir${tar_ext}" + CT_Popd + + CT_DoLog DEBUG " Restoring CT_CC_CORE_STATIC_PREFIX_DIR=\"${CT_CC_CORE_STATIC_PREFIX_DIR}\"" + CT_Pushd "${CT_CC_CORE_STATIC_PREFIX_DIR}" + tar ${tar_opt} "${state_dir}/cc_core_static_prefix_dir${tar_ext}" CT_Popd # Restore the environment, discarding any error message -- cgit v0.10.2-6-g49f6