2008-09-19 Christian Franke <franke@computer.org>

* aclocal.m4 (grub_CHECK_ENABLE_EXECUTE_STACK): New function.
	* configure.ac: Call grub_CHECK_ENABLE_EXECUTE_STACK.
	* include/grub/misc.h [NEED_ENABLE_EXECUTE_STACK]:
	Export __enable_execute_stack() to modules.
	* kern/misc.c [NEED_ENABLE_EXECUTE_STACK] (__enable_execute_stack):
	New function.
This commit is contained in:
chrfranke 2008-09-19 06:55:20 +00:00
parent 040030b3f2
commit 9035dce47f
7 changed files with 96 additions and 0 deletions

41
configure vendored
View file

@ -6775,6 +6775,47 @@ fi
# Compiler features.
#
# Need __enable_execute_stack() for nested function trampolines?
{ echo "$as_me:$LINENO: checking whether \`$CC' generates calls to \`__enable_execute_stack()'" >&5
echo $ECHO_N "checking whether \`$CC' generates calls to \`__enable_execute_stack()'... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
void f (int (*p) (void));
void g (int i)
{
int nestedfunc (void) { return i; }
f (nestedfunc);
}
_ACEOF
if { ac_try='${CC-cc} ${CFLAGS} -S conftest.c'
{ (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); }; } && test -s conftest.s; then
true
else
{ { echo "$as_me:$LINENO: error: ${CC-cc} failed to produce assembly code" >&5
echo "$as_me: error: ${CC-cc} failed to produce assembly code" >&2;}
{ (exit 1); exit 1; }; }
fi
if grep __enable_execute_stack conftest.s >/dev/null 2>&1; then
cat >>confdefs.h <<\_ACEOF
#define NEED_ENABLE_EXECUTE_STACK 1
_ACEOF
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
rm -f conftest*
# Smashing stack protector.
# Smashing stack protector.