[coreboot-gerrit] Patch set updated for coreboot: buildgcc: Add option to bootstrap a host gcc
Nico Huber (nico.h@gmx.de)
gerrit at coreboot.org
Sun Apr 17 15:37:10 CEST 2016
Nico Huber (nico.h at gmx.de) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13473
-gerrit
commit 2ebf979ca64e66de480bb84f53b4b5e45e5b0a89
Author: Nico Huber <nico.huber at secunet.com>
Date: Tue Jan 26 16:10:17 2016 +0100
buildgcc: 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 at secunet.com>
---
util/crossgcc/buildgcc | 49 ++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 46 insertions(+), 3 deletions(-)
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index eddafe5..25cc219 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -18,8 +18,8 @@
cd $(dirname $0)
-CROSSGCC_DATE="April 3rd, 2016"
-CROSSGCC_VERSION="1.38"
+CROSSGCC_DATE="April 17th, 2016"
+CROSSGCC_VERSION="1.39"
CROSSGCC_COMMIT=$( git describe )
# default settings
@@ -30,6 +30,7 @@ LANGUAGES=c
DESTDIR=
SAVETEMPS=0
SKIPPYTHON=1
+BOOTSTRAP=0
# GCC toolchain version numbers
GMP_VERSION=6.1.0
@@ -342,6 +343,9 @@ build_for_target()
build()
{
if package_uses_targetarch $1; then
+ if [ $BOOTSTRAP -eq 1 -a ! -f "${TARGETDIR}/.GCC.success" ]; then
+ build_for_host GCC
+ fi
build_for_target $1
else
build_for_host $1
@@ -381,6 +385,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"
@@ -493,8 +499,36 @@ build_BINUTILS() {
$MAKE install DESTDIR=$DESTDIR || touch .failed
}
+bootstrap_GCC() {
+ # Work around crazy code generator in GCC that confuses CLANG.
+ $CC --version | grep clang >/dev/null 2>&1 && \
+ LOCALCFLAGS="$HOSTCFLAGS -fbracket-depth=1024" || \
+ LOCALCFLAGS="$HOSTCFLAGS"
+
+ CC="$CC" \
+ CFLAGS="$LOCALCFLAGS" \
+ CFLAGS_FOR_BUILD="$LOCALCFLAGS" \
+ CFLAGS_FOR_TARGET="$LOCALCFLAGS" \
+ CXXFLAGS="$LOCALCFLAGS" \
+ CXXFLAGS_FOR_BUILD="$LOCALCFLAGS" \
+ CXXFLAGS_FOR_TARGET="$LOCALCFLAGS" \
+ ../gcc-${GCC_VERSION}/configure \
+ --prefix=$TARGETDIR --libexecdir=$TARGETDIR/lib \
+ --enable-bootstrap \
+ --disable-werror --disable-nls \
+ --disable-multilib \
+ --disable-libssp --disable-libquadmath \
+ ${GCC_OPTIONS} --enable-languages="${LANGUAGES}" \
+ --with-gmp=$DESTDIR$TARGETDIR --with-mpfr=$DESTDIR$TARGETDIR \
+ --with-mpc=$DESTDIR$TARGETDIR --with-libelf=$DESTDIR$TARGETDIR \
+ --with-pkgversion="coreboot bootstrap v$CROSSGCC_VERSION $CROSSGCC_DATE" \
+ && \
+ $MAKE $JOBS BOOT_CFLAGS="$LOCALCFLAGS" BUILD_CONFIG="" bootstrap && \
+ $MAKE install DESTDIR=$DESTDIR && \
+ ln -s gcc $DESTDIR$TARGETDIR/bin/cc || touch .failed
+}
-build_GCC() {
+build_cross_GCC() {
# Work around crazy code generator in GCC that confuses CLANG.
$CC --version | grep clang >/dev/null 2>&1 && \
HOSTCFLAGS="$HOSTCFLAGS -fbracket-depth=1024"
@@ -532,6 +566,14 @@ build_GCC() {
fi
}
+build_GCC() {
+ if [ "$1" = host ]; then
+ bootstrap_GCC
+ else
+ build_cross_GCC
+ fi
+}
+
build_EXPAT() {
CC="$CC" CFLAGS="$HOSTCFLAGS" ../${EXPAT_DIR}/configure --disable-shared \
--prefix=$TARGETDIR --target=${TARGETARCH} || touch .failed
@@ -657,6 +699,7 @@ while true ; do
-c|--clean) shift; clean=1;;
-t|--savetemps) shift; SAVETEMPS=1;;
-d|--directory) shift; TARGETDIR="$1"; shift;;
+ -b|--bootstrap) shift; BOOTSTRAP=1;;
-p|--platform) shift; TARGETARCH="$1"; shift;;
-l|--languages) shift; LANGUAGES="$1"; shift;;
-D|--destdir) shift; DESTDIR="$1"; shift;;
More information about the coreboot-gerrit
mailing list