Nico Huber (nico.h@gmx.de) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13473
-gerrit
commit 180a84ddef993218b0cac11a97d4de6445490f64 Author: Nico Huber nico.huber@secunet.com Date: Tue Jan 26 16:10:17 2016 +0100
util/crossgcc: Add option to bootstrap a host gcc
Bootstrapping gcc is the recommended way if your host gcc's version doesn't match the gcc version you're going to build. While a build with an outdated host gcc usually succeeds, an outdated gnat seems to be a bigger issue.
Change-Id: Icb47d3e9dbafc55737fbc3ce62a084fb9d5f359a Signed-off-by: Nico Huber nico.huber@secunet.com --- util/crossgcc/Makefile | 3 ++- util/crossgcc/buildgcc | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/util/crossgcc/Makefile b/util/crossgcc/Makefile index 79e0c3c..4f5d919 100644 --- a/util/crossgcc/Makefile +++ b/util/crossgcc/Makefile @@ -25,7 +25,8 @@ build_tools: build_gcc build_iasl build_gdb
build_gcc: bash ./buildgcc -p $(BUILD_PLATFORM) $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) \ - $(if $(BUILD_LANGUAGES),-l $(BUILD_LANGUAGES)) + $(if $(BUILD_LANGUAGES),-l $(BUILD_LANGUAGES)) \ + $(if $(BUILD_BOOTSTRAP),-b) \
build_gdb: ifeq ($(SKIP_GDB),) diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc index 61c26d9..1150bdc 100755 --- a/util/crossgcc/buildgcc +++ b/util/crossgcc/buildgcc @@ -19,7 +19,7 @@ cd $(dirname $0)
CROSSGCC_DATE="January 26th, 2016" -CROSSGCC_VERSION="1.35" +CROSSGCC_VERSION="1.36"
# default settings PACKAGE=GCC @@ -31,6 +31,7 @@ DESTDIR= CLEANHOST=0 SAVETEMPS=0 SKIPPYTHON=1 +BOOTSTRAP=0
# GCC toolchain version numbers GMP_VERSION=6.1.0 @@ -367,6 +368,8 @@ myhelp() printf " [-P|--package <package>] Build a specific package: GCC, CLANG, IASL, GDB\n" printf " (defaults to $PACKAGE)\n" printf "GCC specific options:\n" + printf " [-b|--bootstrap] bootstrap the host compiler before building\n" + printf " the cross compiler\n" printf " [-p|--platform <platform>] target platform to build cross compiler for\n" printf " (defaults to $TARGETARCH)\n" printf " [-l|--languages <languages>] comma separated list of target languages\n" @@ -467,8 +470,24 @@ build_BINUTILS() { $MAKE install DESTDIR=$DESTDIR || touch .failed }
+build_host_GCC() { + CC="$CC" CFLAGS_FOR_TARGET="-O2" BOOT_CFLAGS="-O2" \ + ../gcc-${GCC_VERSION}/configure \ + --prefix=$HOSTDIR --libexecdir=$HOSTDIR/lib \ + --enable-bootstrap \ + --disable-werror --disable-nls --disable-multilib \ + --disable-libssp --disable-libquadmath \ + ${GCC_OPTIONS} --enable-languages="${LANGUAGES}" \ + --with-gmp=$DESTDIR$HOSTDIR --with-mpfr=$DESTDIR$HOSTDIR \ + --with-mpc=$DESTDIR$HOSTDIR --with-libelf=$DESTDIR$HOSTDIR \ + --with-pkgversion="coreboot toolchain host bootstrap v$CROSSGCC_VERSION $CROSSGCC_DATE" \ + && \ + $MAKE $JOBS CFLAGS_FOR_BUILD="-O2" BOOT_CFLAGS="-O2" bootstrap && \ + $MAKE install DESTDIR=$DESTDIR && \ + ln -s gcc $DESTDIR$HOSTDIR/bin/cc || touch .failed +}
-build_GCC() { +build_target_GCC() { # GCC does not honor HOSTCFLAGS at all. CFLAGS are used for # both target and host object files. # There's a work-around called CFLAGS_FOR_BUILD and CFLAGS_FOR_TARGET @@ -495,6 +514,14 @@ build_GCC() { fi }
+build_GCC() { + if is_host_package $1; then + build_host_GCC $@ + else + build_target_GCC $@ + fi +} + build_EXPAT() { CC="$CC" CFLAGS="$HOSTCFLAGS" ../${EXPAT_DIR}/configure --disable-shared \ --prefix=$HOSTDIR --target=${TARGETARCH} || touch .failed @@ -614,6 +641,7 @@ while true ; do TARGETDIR="$(echo $1 | sed -e 's,/*$,,')" HOSTDIR="$TARGETDIR-host" shift;; + -b|--bootstrap) shift; BOOTSTRAP=1;; -p|--platform) shift; TARGETARCH="$1"; shift;; -l|--languages) shift; LANGUAGES="$1"; shift;; -D|--destdir) shift; DESTDIR="$1"; shift;; @@ -656,7 +684,11 @@ case "$PACKAGE" in GCC|gcc) echo "Target architecture is now $TARGETARCH" NAME="${TARGETARCH} cross GCC" - PACKAGES="host-GMP host-MPFR host-MPC host-LIBELF BINUTILS GCC" + if [ $BOOTSTRAP -eq 1 ]; then + PACKAGES="host-GMP host-MPFR host-MPC host-LIBELF host-GCC BINUTILS GCC" + else + PACKAGES="host-GMP host-MPFR host-MPC host-LIBELF BINUTILS GCC" + fi ;; GDB|gdb) NAME="${TARGETARCH} cross GDB"