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

27
aclocal.m4 vendored
View file

@ -379,6 +379,33 @@ dnl So use regparm 2 until a better test is found.
[Catch gcc bug])
fi
])
dnl Check if the C compiler generates calls to `__enable_execute_stack()'.
AC_DEFUN(grub_CHECK_ENABLE_EXECUTE_STACK,[
AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()'])
AC_LANG_CONFTEST([[
void f (int (*p) (void));
void g (int i)
{
int nestedfunc (void) { return i; }
f (nestedfunc);
}
]])
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -S conftest.c]) && test -s conftest.s; then
true
else
AC_MSG_ERROR([${CC-cc} failed to produce assembly code])
fi
if grep __enable_execute_stack conftest.s >/dev/null 2>&1; then
AC_DEFINE([NEED_ENABLE_EXECUTE_STACK], 1,
[Define to 1 if GCC generates calls to __enable_execute_stack()])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
rm -f conftest*
])
dnl Check if the C compiler supports `-fstack-protector'.
AC_DEFUN(grub_CHECK_STACK_PROTECTOR,[