summaryrefslogtreecommitdiff
path: root/util/crossgcc/buildgcc
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2017-06-26 07:21:46 +0200
committerPatrick Georgi <pgeorgi@google.com>2017-06-27 05:27:53 +0000
commita7a5a56370db557a8d5f02a22de101939a0d3c0b (patch)
tree7cfadcf382e2065ec3e0858896b157c577a511a0 /util/crossgcc/buildgcc
parent98409cff92c741e94ede1a396293c48d05dd9a25 (diff)
crossgcc: Fix building with clang++ in the presence of gcc
Some environments (<grumble>cros_sdk</grumble>) provide gcc as $CC and clang++ as $CXX. The latter needs the higher bracket-depth while the former has no idea what it means, so tell CC and CXX individually. Change-Id: I72b75fb9bb5df3a9b1561ee8821ec43ada29b24f Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: https://review.coreboot.org/20365 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'util/crossgcc/buildgcc')
-rwxr-xr-xutil/crossgcc/buildgcc13
1 files changed, 9 insertions, 4 deletions
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index 58403514cd..fdf8906151 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -645,7 +645,9 @@ bootstrap_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"
+ CLANGFLAGS="-fbracket-depth=1024"
+ $CXX --version | grep clang >/dev/null 2>&1 && \
+ CLANGCXXFLAGS="-fbracket-depth=1024"
# GCC does not honor HOSTCFLAGS at all. CFLAGS are used for
# both target and host object files.
@@ -655,9 +657,12 @@ build_cross_GCC() {
# Also set the CXX version of the flags because GCC is now compiled
# using C++.
CC="$(hostcc target)" CXX="$(hostcxx target)" \
- CFLAGS_FOR_TARGET="-O2 -Dinhibit_libc" CFLAGS="$HOSTCFLAGS" \
- CFLAGS_FOR_BUILD="$HOSTCFLAGS" CXXFLAGS="$HOSTCFLAGS" \
- CXXFLAGS_FOR_BUILD="$HOSTCFLAGS" ../gcc-${GCC_VERSION}/configure \
+ CFLAGS_FOR_TARGET="-O2 -Dinhibit_libc"
+ CFLAGS="$HOSTCFLAGS $CLANGFLAGS" \
+ CFLAGS_FOR_BUILD="$HOSTCFLAGS $CLANGFLAGS" \
+ CXXFLAGS="$HOSTCFLAGS $CLANGCXXFLAGS" \
+ CXXFLAGS_FOR_BUILD="$HOSTCFLAGS $CLANGCXXFLAGS" \
+ ../gcc-${GCC_VERSION}/configure \
--prefix=$TARGETDIR --libexecdir=$TARGETDIR/lib \
--target=${TARGETARCH} --disable-werror --disable-shared \
--enable-lto --enable-plugins --enable-gold --enable-ld=default \