2004-04-04 Yoshinori K. Okuji <okuji@enbug.org>

* configure.ac (STAGE2_CFLAGS): Check if -fno-stack-protector is
	supported by GCC. If yes, added the option. This is necessary
	for OpenBSD, because the stack protector defines additional
	symbols. Reported by uc.sheda <uc.sheda@laposte.net>.
This commit is contained in:
okuji 2004-04-04 09:15:43 +00:00
parent 065f6e0a20
commit 0accb2cab8
9 changed files with 82 additions and 6 deletions

View file

@ -97,6 +97,21 @@ if test "x$ac_cv_prog_gcc" = xyes; then
else
STAGE2_CFLAGS="-O2 -fno-strength-reduce -fno-unroll-loops"
fi
# OpenBSD has a GCC extension for protecting applications from
# stack smashing attacks, but GRUB doesn't want this feature.
AC_CACHE_CHECK([whether gcc has -fno-stack-protector],
no_stack_protector_flag, [
saved_CFLAGS=$CFLAGS
CFLAGS="-fno-stack-protector"
AC_TRY_COMPILE(,
,
no_stack_protector_flag=yes,
no_stack_protector_flag=no)
CFLAGS=$saved_CFLAGS
])
if test "x$no_stack_protector_flag" = xyes; then
STAGE2_CFLAGS="$STAGE2_CFLAGS -fno-stack-protector"
fi
fi
fi