mkelfImage: Use -fno-stack-protector if supported by gcc

Gcc 4.1 comes with an SSP https://wiki.ubuntu.com/GccSsp
This is disabled to work around '__stack_chk_fail' symbol not found failures
http://www.coreboot.org/FAQ/Obsolete#How_do_I_fix_stack_chk_fail_errors.3F

The presence of -fno-stack-protector is tested for automatically by configure.

Change-Id: I28ef158829f5935f985cfd5a5440733685cf479a
Reported-by: Raymond Danks <raymonddanks@gmail.com>
Signed-off-by: Raymond Danks <raymonddanks@gmail.com>
Reviewed-on: http://review.coreboot.org/112
Tested-by: build bot (Jenkins)
Reviewed-by: Peter Stuge <peter@stuge.se>
This commit is contained in:
Raymond Danks
2011-09-03 21:45:38 -06:00
committed by Peter Stuge
parent 03f82bd787
commit 62ff00e13f
2 changed files with 58 additions and 1 deletions

View File

@@ -186,6 +186,27 @@ IA64_ASFLAGS='-mconstant-gp -mauto-pic'
IA64_LDFLAGS='-static --warn-multiple-gp --warn-common'
AC_SUBST([HOST_CC])
AC_CACHE_CHECK(for -fno-stack-protector, libc_cv_fno_stack_protector, [
cat > conftest.c <<EOF
int foo;
main () { return 0;}
EOF
if AC_TRY_COMMAND([$I386_CC -fno-stack-protector
-o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
then
libc_cv_fno_stack_protector=yes
else
libc_cv_fno_stack_protector=no
fi
rm -f conftest*])
if test $libc_cv_fno_stack_protector = yes; then
I386_CFLAGS="$I386_CFLAGS -fno-stack-protector"
IA64_CFLAGS="$IA64_CFLAGS -fno-stack-protector"
fi
AC_SUBST(libc_cv_fno_stack_protector)
AC_SUBST([HOST_CFLAGS])
AC_SUBST([I386_CC])