From 1a29c1e7665c22476b74d469952d7e689d475cdf Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Thu, 14 Feb 2013 15:26:09 -0800 Subject: 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 Reviewed-on: http://review.coreboot.org/2399 Tested-by: build bot (Jenkins) Reviewed-by: Gabe Black --- payloads/libpayload/bin/lpgcc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'payloads') 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 -- cgit v1.2.3