From: Kevin O'Connor Date: Fri, 27 Mar 2009 04:07:07 +0000 (-0400) Subject: Enhance gcc checks. X-Git-Tag: rel-0.4.1~117 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=84452f145ea15c7b59e3ae24ecaae672b824b4e5;p=seabios.git Enhance gcc checks. Use -Os on visible function test - it seems to alter behavior. Add check for global variables being present. --- diff --git a/tools/test-gcc.sh b/tools/test-gcc.sh index 1dce450..c08ed82 100755 --- a/tools/test-gcc.sh +++ b/tools/test-gcc.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Script to test if gcc's -combine option works properly. +# Script to test if gcc "-fwhole-program" works properly. mkdir -p out TMPFILE1=out/tmp_testcompile1.c @@ -17,17 +17,36 @@ if [ $? -ne 0 ]; then exit -1 fi +# Test if "visible" variables are marked global. +cat - > $TMPFILE1 < /dev/null 2>&1 +cat - > $TMPFILE2 < /dev/null 2>&1 +$CC -Os $TMPFILE1o $TMPFILE2o -o $TMPFILE3o > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "This version of gcc does not properly handle" > /dev/fd/2 + echo " global variables in -fwhole-program mode." > /dev/fd/2 + echo "Please upgrade to a newer gcc (eg, v4.3 or later)" > /dev/fd/2 + echo -1 + exit -1 +fi + # Test if "visible" functions are marked global. cat - > $TMPFILE1 < /dev/null 2>&1 +$CC -Os -c -fwhole-program $TMPFILE1 -o $TMPFILE1o > /dev/null 2>&1 cat - > $TMPFILE2 < /dev/null 2>&1 -$CC $TMPFILE1o $TMPFILE2o -o $TMPFILE3o > /dev/null 2>&1 +$CC -Os -c -fwhole-program $TMPFILE2 -o $TMPFILE2o > /dev/null 2>&1 +$CC -Os $TMPFILE1o $TMPFILE2o -o $TMPFILE3o > /dev/null 2>&1 if [ $? -ne 0 ]; then echo " Working around non-global functions in -fwhole-program" > /dev/fd/2 fi