--- qemu/roms/seabios/tools/test-gcc.sh 2018/04/24 17:52:24 1.1.1.2 +++ qemu/roms/seabios/tools/test-gcc.sh 2018/04/24 19:44:00 1.1.1.4 @@ -4,15 +4,48 @@ mkdir -p out TMPFILE1=out/tmp_testcompile1.c TMPFILE1o=out/tmp_testcompile1.o +TMPFILE1_ld=out/tmp_testcompile1.lds TMPFILE2=out/tmp_testcompile2.c TMPFILE2o=out/tmp_testcompile2.o TMPFILE3o=out/tmp_testcompile3.o +# Test if ld's alignment handling is correct. This is a known problem +# with the linker that ships with Ubuntu 11.04. +cat - > $TMPFILE1 < $TMPFILE1_ld < /dev/null 2>&1 +$LD -T $TMPFILE1_ld $TMPFILE1o -o $TMPFILE2o > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "The version of LD on this system does not properly handle" >&2 + echo "alignments. As a result, this project can not be built." >&2 + echo "" >&2 + echo "The problem may be the result of this LD bug report:" >&2 + echo " http://sourceware.org/bugzilla/show_bug.cgi?id=12726" >&2 + echo "" >&2 + echo "Please update to a working version of binutils and retry." >&2 + echo -1 + exit 0 +fi + # Test for "-fwhole-program". Older versions of gcc (pre v4.1) don't # support the whole-program optimization - detect that. $CC -fwhole-program -S -o /dev/null -xc /dev/null > /dev/null 2>&1 if [ $? -ne 0 ]; then - echo " Working around no -fwhole-program" > /dev/fd/2 + echo " Working around no -fwhole-program" >&2 echo 2 exit 0 fi @@ -36,7 +69,7 @@ EOF $CC -Os -c -fwhole-program $TMPFILE2 -o $TMPFILE2o > /dev/null 2>&1 $CC -nostdlib -Os $TMPFILE1o $TMPFILE2o -o $TMPFILE3o > /dev/null 2>&1 if [ $? -ne 0 ]; then - echo " Working around non-functional -fwhole-program" > /dev/fd/2 + echo " Working around non-functional -fwhole-program" >&2 echo 2 exit 0 fi @@ -71,7 +104,7 @@ $CC -O -g -fwhole-program -combine -c $T if [ $? -eq 0 ]; then echo 0 else - echo " Working around non-functional -combine" > /dev/fd/2 + echo " Working around non-functional -combine" >&2 echo 1 fi @@ -85,4 +118,4 @@ fi # "ebp" register is clobberred in an "asm" statement. The code has # been modified to not clobber "ebp" - no test is available yet. -rm -f $TMPFILE1 $TMPFILE1o $TMPFILE2 $TMPFILE2o $TMPFILE3o +rm -f $TMPFILE1 $TMPFILE1o $TMPFILE1_ld $TMPFILE2 $TMPFILE2o $TMPFILE3o