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>
This commit is contained in:
Ronald G. Minnich 2013-02-14 15:26:09 -08:00 committed by Gabe Black
parent 2cc105c741
commit 1a29c1e766
1 changed files with 6 additions and 3 deletions

View File

@ -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