summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonald G. Minnich <rminnich@gmail.com>2013-02-14 15:26:09 -0800
committerGabe Black <gabeblack@chromium.org>2013-02-15 06:51:52 +0100
commit1a29c1e7665c22476b74d469952d7e689d475cdf (patch)
tree4d1d48503e5117423947c83ded75ffadbc7cb71b
parent2cc105c741357e7dc13a456726456bdbb6fcb5e6 (diff)
downloadcoreboot-1a29c1e7665c22476b74d469952d7e689d475cdf.tar.xz
libpayload: fix compiler flags
lpgcc was unconditionally setting -m32. Most of the flags it sets in the common case are right, however: no need to duplicate them everywhere, and we only want to change the common ones in one place, so it would be a shame to duplicate _CFLAGS all over the place. So add another variable, _ARCHEXTRA, which can be used to add special flags to _CFLAGS. We onlu use it at present for the x86; this may change. This allows us to get through compiling on arm and x86. Change-Id: I12f1620982c4ee10f76b3953e4225f13db31531e Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Reviewed-on: http://review.coreboot.org/2399 Tested-by: build bot (Jenkins) Reviewed-by: Gabe Black <gabeblack@chromium.org>
-rwxr-xr-xpayloads/libpayload/bin/lpgcc9
1 files changed, 6 insertions, 3 deletions
diff --git a/payloads/libpayload/bin/lpgcc b/payloads/libpayload/bin/lpgcc
index 52a8e554c0..06b9021fbf 100755
--- a/payloads/libpayload/bin/lpgcc
+++ b/payloads/libpayload/bin/lpgcc
@@ -110,26 +110,29 @@ done
if [ "$CONFIG_ARCH_ARMV7" = "y" ]; then
_ARCHINCDIR=$_INCDIR/armv7
_ARCHLIBDIR=$_LIBDIR/armv7
+ _ARCHEXTRA=""
fi
if [ "$CONFIG_ARCH_POWERPC" = "y" ]; then
_ARCHINCDIR=$_INCDIR/powerpc
_ARCHLIBDIR=$_LIBDIR/powerpc
+ _ARCHEXTRA=""
fi
if [ "$CONFIG_ARCH_X86" = "y" ]; then
_ARCHINCDIR=$_INCDIR/x86
_ARCHLIBDIR=$_LIBDIR/x86
+ _ARCHEXTRA="-m32 "
fi
-_CFLAGS="-m32 -nostdinc -nostdlib -I$_INCDIR -I$_ARCHINCDIR -D__LIBPAYLOAD__=1"
+_CFLAGS="$_ARCHEXTRA -nostdinc -nostdlib -I$_INCDIR -I$_ARCHINCDIR -D__LIBPAYLOAD__=1"
# Check for the -fno-stack-protector silliness
trygccoption -fno-stack-protector
[ $? -eq 0 ] && _CFLAGS="$_CFLAGS -fno-stack-protector"
-_CFLAGS="$_CFLAGS -I`$DEFAULT_CC -m32 -print-search-dirs | head -n 1 | cut -d' ' -f2`include"
+_CFLAGS="$_CFLAGS -I`$DEFAULT_CC $_ARCHEXTRA -print-search-dirs | head -n 1 | cut -d' ' -f2`include"
_LDFLAGS="-L$BASE/../lib $_LDSCRIPT -static"
@@ -140,7 +143,7 @@ if [ $DOLINK -eq 0 ]; then
$DEFAULT_CC $_CFLAGS $CMDLINE
else
- _LIBGCC=`$DEFAULT_CC -m32 -print-libgcc-file-name`
+ _LIBGCC=`$DEFAULT_CC $_ARCHEXTRA -print-libgcc-file-name`
if [ $DEBUGME -eq 1 ]; then
echo "$DEFAULT_CC $_CFLAGS $_LDFLAGS $_ARCHLIBDIR/head.o $CMDLINE -lpayload $_LIBGCC"
fi