summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2016-04-03 20:52:01 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2016-04-06 19:27:16 +0200
commit45f77b81a49de76cb723ca4c5af7d89a97e67016 (patch)
tree507a0c277117f3dd5a2a3a1d89114fae73a9f7a2
parenta4fbc385e0910510b0e46007a51c8d48609e88a8 (diff)
downloadcoreboot-45f77b81a49de76cb723ca4c5af7d89a97e67016.tar.xz
crossgcc: Fix compilation on Clang systems
Most cross compilers fail to compile on systems with Clang being the default compiler (OS X and some BSDs). Clang dislikes some of GCC's autogenerated code. We also missed switching CFLAGS to CXXFLAGS when GCC switched to C++ compilation per default. Change-Id: I87caa1a15982c431048aa79748ea7ef655a9a3a1 Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: https://review.coreboot.org/14232 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
-rwxr-xr-xutil/crossgcc/buildgcc13
1 files changed, 10 insertions, 3 deletions
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index 525b574b3b..96e4c193eb 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -18,8 +18,8 @@
cd $(dirname $0)
-CROSSGCC_DATE="March 21st, 2016"
-CROSSGCC_VERSION="1.37"
+CROSSGCC_DATE="April 3rd, 2016"
+CROSSGCC_VERSION="1.38"
# default settings
PACKAGE=GCC
@@ -453,13 +453,20 @@ build_BINUTILS() {
build_GCC() {
+ # Work around crazy code generator in GCC that confuses CLANG.
+ $CC --version | grep clang &>/dev/null &&
+ HOSTCFLAGS="$HOSTCFLAGS -fbracket-depth=1024"
+
# 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
# but it does not seem to work properly. At least the host library
# libiberty is not compiled with CFLAGS_FOR_BUILD.
+ # Also set the CXX version of the flags because GCC is now compiled
+ # using C++.
CC="$CC" CFLAGS_FOR_TARGET="-O2 -Dinhibit_libc" CFLAGS="$HOSTCFLAGS" \
- CFLAGS_FOR_BUILD="$HOSTCFLAGS" ../gcc-${GCC_VERSION}/configure \
+ CFLAGS_FOR_BUILD="$HOSTCFLAGS" CXXFLAGS="$HOSTCFLAGS" \
+ CXXFLAGS_FOR_BUILD="$HOSTCFLAGS" ../gcc-${GCC_VERSION}/configure \
--prefix=$TARGETDIR --libexecdir=$TARGETDIR/lib \
--target=${TARGETARCH} --disable-werror --disable-shared \
--enable-lto --enable-plugins --enable-gold --enable-ld=default \