[coreboot] New patch to review for coreboot: 219d49b libpayload: fix compiler flags

Ronald G. Minnich (rminnich@gmail.com) gerrit at coreboot.org
Fri Feb 15 00:28:13 CET 2013


Ronald G. Minnich (rminnich at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2399

-gerrit

commit 219d49ba4a9999dfa1e2cdb73c730c1122102c0f
Author: Ronald G. Minnich <rminnich at gmail.com>
Date:   Thu Feb 14 15:26:09 2013 -0800

    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 at gmail.com>
---
 payloads/libpayload/bin/lpgcc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/payloads/libpayload/bin/lpgcc b/payloads/libpayload/bin/lpgcc
index 52a8e55..06b9021 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



More information about the coreboot mailing list