]> xenbits.xensource.com Git - seabios.git/commitdiff
Don't use gcc's -combine option.
authorKevin O'Connor <kevin@koconnor.net>
Wed, 12 Dec 2012 02:59:45 +0000 (21:59 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 12 Dec 2012 02:59:45 +0000 (21:59 -0500)
The combine option has been deprecated from gcc for the last few
revisions.  The option doesn't add any real benefits, so there's no
real point in checking for it on the few systems that will still have
it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Makefile
tools/test-build.sh

index fa30bb3a1d22e38172920fd590bb5ef3f73f1b21..b89a0384508c90fce76e19779d5091d95a143b20 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -89,34 +89,17 @@ ifeq "$(TESTGCC)" "-1"
 $(error "Please upgrade the build environment")
 endif
 
-ifndef COMPSTRAT
-COMPSTRAT=$(TESTGCC)
+ifeq "$(TESTGCC)" "0"
+# Use -fwhole-program
+CFLAGSWHOLE=-fwhole-program -DWHOLE_PROGRAM
 endif
 
-# Do a whole file compile - three methods are supported.
-ifeq "$(COMPSTRAT)" "1"
-# First method - use -fwhole-program without -combine.
+# Do a whole file compile by textually including all C code.
 define whole-compile
 @echo "  Compiling whole program $3"
 $(Q)printf '$(foreach i,$2,#include "../$i"\n)' > $3.tmp.c
-$(Q)$(CC) $1 -fwhole-program -DWHOLE_PROGRAM -c $3.tmp.c -o $3
+$(Q)$(CC) $1 $(CFLAGSWHOLE) -c $3.tmp.c -o $3
 endef
-else
-ifeq "$(COMPSTRAT)" "2"
-# Second menthod - don't use -fwhole-program at all.
-define whole-compile
-@echo "  Compiling whole program $3"
-$(Q)printf '$(foreach i,$2,#include "../$i"\n)' > $3.tmp.c
-$(Q)$(CC) $1 -c $3.tmp.c -o $3
-endef
-else
-# Third (and preferred) method - use -fwhole-program with -combine
-define whole-compile
-@echo "  Compiling whole program $3"
-$(Q)$(CC) $1 -fwhole-program -DWHOLE_PROGRAM -combine -c $2 -o $3
-endef
-endif
-endif
 
 %.strip.o: %.o
        @echo "  Stripping $@"
index 7d36ae835f10bc370b9593d899ba63243a50b3c3..7bd6d1fe4c9f8a6e29dbe209769bc82e0a5ffd42 100755 (executable)
@@ -87,45 +87,7 @@ if [ $? -ne 0 ]; then
     exit 0
 fi
 
-# Test if "-combine" works.  On Ubuntu 8.04 the compiler doesn't work
-# correctly with combine and the "struct bregs" register due to the
-# anonymous unions and structs.  On Fedora Core 12 the compiler throws
-# an internal compiler error when multiple files access global
-# variables with debugging enabled.
-cat - > $TMPFILE1 <<EOF
-// Look for anonymous union/struct failure
-struct ts { union { int u1; struct { int u2; }; }; };
-void func1(struct ts *r);
-
-// Look for global variable failure.
-struct s1_s { int v; } g1;
-void __attribute__((externally_visible)) func2() {
-    struct s1_s *l1 = &g1;
-    l1->v=0;
-}
-EOF
-cat - > $TMPFILE2 <<EOF
-struct ts { union { int u1; struct { int u2; }; }; };
-void func1(struct ts *r);
-
-extern struct s1_s g1;
-void func3() {
-    &g1;
-}
-EOF
-$CC -O -g -fwhole-program -combine -c $TMPFILE1 $TMPFILE2 -o $TMPFILE1o > /dev/null 2>&1
-if [ $? -eq 0 ]; then
-    echo 0
-else
-    echo "  Working around non-functional -combine" >&2
-    echo 1
-fi
-
-# Also, on several compilers, -combine fails if code is emitted with a
-# reference to an extern variable that is later found to be externally
-# visible - the compiler does not mark those variables as global.
-# This is being worked around by ordering the compile objects to avoid
-# this case.
+echo 0
 
 # Also, the Ubuntu 8.04 compiler has a bug causing corruption when the
 # "ebp" register is clobberred in an "asm" statement.  The code has