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

@ -1,3 +1,10 @@
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>.
2004-03-28 Pavel Roskin <proski@gnu.org>
* stage2/boot.c: Imply --no-mem-option for Linux kernels with

54
configure vendored
View file

@ -3289,6 +3289,60 @@ echo "${ECHO_T}$size_flag" >&6
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.
echo "$as_me:$LINENO: checking whether gcc has -fno-stack-protector" >&5
echo $ECHO_N "checking whether gcc has -fno-stack-protector... $ECHO_C" >&6
if test "${no_stack_protector_flag+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
saved_CFLAGS=$CFLAGS
CFLAGS="-fno-stack-protector"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
no_stack_protector_flag=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
no_stack_protector_flag=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
CFLAGS=$saved_CFLAGS
fi
echo "$as_me:$LINENO: result: $no_stack_protector_flag" >&5
echo "${ECHO_T}$no_stack_protector_flag" >&6
if test "x$no_stack_protector_flag" = xyes; then
STAGE2_CFLAGS="$STAGE2_CFLAGS -fno-stack-protector"
fi
fi
fi

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

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
.TH GRUB-INSTALL "8" "March 2004" "grub-install (GNU GRUB 0.94)" FSF
.TH GRUB-INSTALL "8" "April 2004" "grub-install (GNU GRUB 0.94)" FSF
.SH NAME
grub-install \- install GRUB on your drive
.SH SYNOPSIS

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
.TH GRUB-MD5-CRYPT "8" "March 2004" "grub-md5-crypt (GNU GRUB )" FSF
.TH GRUB-MD5-CRYPT "8" "April 2004" "grub-md5-crypt (GNU GRUB )" FSF
.SH NAME
grub-md5-crypt \- Encrypt a password in MD5 format
.SH SYNOPSIS

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
.TH GRUB-TERMINFO "8" "March 2004" "grub-terminfo (GNU GRUB 0.94)" FSF
.TH GRUB-TERMINFO "8" "April 2004" "grub-terminfo (GNU GRUB 0.94)" FSF
.SH NAME
grub-terminfo \- Generate a terminfo command from a terminfo name
.SH SYNOPSIS

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
.TH GRUB "8" "March 2004" "grub (GNU GRUB 0.94)" FSF
.TH GRUB "8" "April 2004" "grub (GNU GRUB 0.94)" FSF
.SH NAME
grub \- the grub shell
.SH SYNOPSIS

View file

@ -142,9 +142,9 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
sbin_PROGRAMS = grub
@SERIAL_SPEED_SIMULATION_FALSE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1
@SERIAL_SPEED_SIMULATION_TRUE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -DSIMULATE_SLOWNESS_OF_SERIAL=1
@SERIAL_SPEED_SIMULATION_FALSE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1
AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \
-DFSYS_FFS=1 -DFSYS_MINIX=1 -DSUPPORT_HERCULES=1 \

View file

@ -144,10 +144,10 @@ target_alias = @target_alias@
# For <shared.h> and <stage1.h>.
INCLUDES = -I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1
@NETBOOT_SUPPORT_FALSE@LIBDRIVERS =
# Don't build the netboot support by default.
@NETBOOT_SUPPORT_TRUE@LIBDRIVERS = libdrivers.a
@NETBOOT_SUPPORT_FALSE@LIBDRIVERS =
noinst_LIBRARIES = $(LIBDRIVERS)