Fix romstage creation with gcc 4.6 and CAR targets
authorStefan Reinauer <reinauer@chromium.org>
Wed, 12 Oct 2011 19:54:08 +0000 (12:54 -0700)
committerPatrick Georgi <patrick@georgi-clan.de>
Thu, 13 Oct 2011 12:20:12 +0000 (14:20 +0200)
newer gcc versions generate ".section .text" instead of just ".text"
in their assembler output. This patch makes sure that we don't end up
with a superfluous ".section" that makes the build fail.

Add -Wno-unused-but-set-variable to CFLAGS if the flag exists.

Change-Id: I7f24c987433cc5886dde2af27498d3331cbda303
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/252
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
src/arch/x86/Makefile.inc
util/xcompile/xcompile

index e9c00deac337ed06871077cf6fb6a9b3db709cc6..65c2a922478377d4e6925879889361d0557eb5dd 100755 (executable)
@@ -247,7 +247,8 @@ $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDD
 
 $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc
        @printf "    POST       romstage.inc\n"
-       sed -e 's/\.rodata/.rom.data/g' -e 's/\.text/.section .rom.text/g' $^ > $@.tmp
+       sed -e 's/\.rodata/.rom.data/g' -e 's/\^\.text/.section .rom.text/g' \
+               -e 's/\^\.section \.text/.section .rom.text/g' $^ > $@.tmp
        mv $@.tmp $@
 endif
 
index fd4dbeb278e7a261fe5ad02dd44c06c2aa8b8bf7..b68e1b3a7910aa1ea28f86565d31709e2f385d9a 100644 (file)
@@ -79,6 +79,10 @@ CC="${GCCPREFIX}gcc"
 testcc "$CC" "$CFLAGS-Wa,--divide " && CFLAGS="$CFLAGS-Wa,--divide "
 testcc "$CC" "$CFLAGS-fno-stack-protector " && CFLAGS="$CFLAGS-fno-stack-protector "
 testcc "$CC" "$CFLAGS-Wl,--build-id=none " && CFLAGS="$CFLAGS-Wl,--build-id=none "
+# GCC 4.6 is much more picky about unused variables. Turn off it's warnings for
+# now:
+testcc "$CC" "$CFLAGS-Wno-unused-but-set-variable " && \
+              CFLAGS="$CFLAGS-Wno-unused-but-set-variable "
 
 if which gcc 2>/dev/null >/dev/null; then
        HOSTCC=gcc