Remove all trampoline support. Add -Wtrampolines when

present. Remove symbols used for trampolines to make
	link fail if trampolines are present.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-03-03 15:57:30 +01:00
parent 73b5d90fe2
commit 19ce697dfd
7 changed files with 18 additions and 48 deletions

View file

@ -1,3 +1,9 @@
2013-03-03 Vladimir Serbinenko <phcoder@gmail.com>
Remove all trampoline support. Add -Wtrampolines when
present. Remove symbols used for trampolines to make
link fail if trampolines are present.
2013-03-03 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/script/execute.c (grub_script_arglist_to_argv): Move

View file

@ -30,7 +30,7 @@ if COND_mips_loongson
CPPFLAGS_PLATFORM = -DUSE_ASCII_FAILBACK
endif
if COND_mips
CFLAGS_PLATFORM += -mflush-func=grub_cpu_flush_cache
CFLAGS_PLATFORM += -mflush-func=grub_red_herring
CCASFLAGS_PLATFORM = -march=mips3
endif
if COND_sparc64_ieee1275

View file

@ -11,7 +11,6 @@
#if defined (GRUB_UTIL) || !defined (GRUB_MACHINE)
#include <config-util.h>
#define NESTED_FUNC_ATTR
#else
/* Define if C symbols get an underscore after compilation. */
#define HAVE_ASM_USCORE @HAVE_ASM_USCORE@
@ -49,10 +48,4 @@
#define RE_ENABLE_I18N 1
#if defined(__i386__)
#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
#else
#define NESTED_FUNC_ATTR
#endif
#endif

View file

@ -357,21 +357,18 @@ AC_CHECK_HEADER([util.h], [
])
AC_SUBST([LIBUTIL])
AC_CACHE_CHECK([whether -Wno-trampolines work], [grub_cv_host_cc_wnotrampolines], [
AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
SAVED_CFLAGS="$CFLAGS"
# Test for -Wtrampolines rather than -Wno-trampolines to reduce confusion
# in the event of later failures (since -Wno-* is always accepted, but
# produces a diagnostic if something else is wrong).
CFLAGS="$HOST_CFLAGS -Wtrampolines"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
int va_arg_func (int fixed, va_list args);]], [[]])],
[grub_cv_host_cc_wnotrampolines=yes],
[grub_cv_host_cc_wnotrampolines=no])
[grub_cv_host_cc_wtrampolines=yes],
[grub_cv_host_cc_wtrampolines=no])
CFLAGS="$SAVED_CFLAGS"
])
if test x"$grub_host_cv_cc_wnotrampolines" = xyes ; then
HOST_CFLAGS="$HOST_CFLAGS -Wno-trampolines"
if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then
HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines"
fi
#
@ -621,9 +618,6 @@ fi
# Compiler features.
#
# Need __enable_execute_stack() for nested function trampolines?
grub_CHECK_ENABLE_EXECUTE_STACK
# Position independent executable.
grub_CHECK_PIE
[# Need that, because some distributions ship compilers that include
@ -715,7 +709,7 @@ CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
fi
# Check for libgcc symbols
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x __ia64_trampoline __udivsi3 __umoddi3 __udivdi3 __divsi3 __modsi3 __umodsi3 __moddi3 __divdi3 __ctzdi2 __ctzsi2)
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x __udivsi3 __umoddi3 __udivdi3 __divsi3 __modsi3 __umodsi3 __moddi3 __divdi3 __ctzdi2 __ctzsi2)
if test "x$TARGET_APPLE_CC" = x1 ; then
CFLAGS="$TARGET_CFLAGS -nostdlib"
@ -761,21 +755,18 @@ if test x"$grub_cv_cc_isystem" = xyes ; then
fi
fi
AC_CACHE_CHECK([whether -Wno-trampolines work], [grub_cv_cc_wnotrampolines], [
AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
SAVED_CFLAGS="$CFLAGS"
# Test for -Wtrampolines rather than -Wno-trampolines to reduce confusion
# in the event of later failures (since -Wno-* is always accepted, but
# produces a diagnostic if something else is wrong).
CFLAGS="$TARGET_CFLAGS -Wtrampolines"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
int va_arg_func (int fixed, va_list args);]], [[]])],
[grub_cv_cc_wnotrampolines=yes],
[grub_cv_cc_wnotrampolines=no])
[grub_cv_cc_wtrampolines=yes],
[grub_cv_cc_wtrampolines=no])
CFLAGS="$SAVED_CFLAGS"
])
if test x"$grub_cv_cc_wnotrampolines" = xyes ; then
TARGET_CFLAGS="$TARGET_CFLAGS -Wno-trampolines"
if test x"$grub_cv_cc_wtrampolines" = xyes ; then
TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines"
fi
# Restore the flags.

View file

@ -1120,14 +1120,6 @@ grub_abort (void)
void abort (void) __attribute__ ((alias ("grub_abort")));
#endif
#if NEED_ENABLE_EXECUTE_STACK && !defined(GRUB_UTIL) && !defined(GRUB_MACHINE_EMU)
/* Some gcc versions generate a call to this function
in trampolines for nested functions. */
void __enable_execute_stack (void *addr __attribute__ ((unused)))
{
}
#endif
#if NEED_REGISTER_FRAME_INFO && !defined(GRUB_UTIL)
void __register_frame_info (void)
{

View file

@ -74,14 +74,6 @@ void EXPORT_FUNC (__ctzsi2) (void);
# endif
#endif
# ifdef HAVE___IA64_TRAMPOLINE
void EXPORT_FUNC (__ia64_trampoline) (void);
# endif
#ifdef HAVE___TRAMPOLINE_SETUP
void EXPORT_FUNC (__trampoline_setup) (void);
#endif
#ifdef HAVE__RESTGPR_14_X
void EXPORT_FUNC (_restgpr_14_x) (void);
void EXPORT_FUNC (_restgpr_15_x) (void);

View file

@ -382,10 +382,6 @@ grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
grub_uint64_t d,
grub_uint64_t *r);
#if !defined(GRUB_UTIL) && NEED_ENABLE_EXECUTE_STACK
void EXPORT_FUNC(__enable_execute_stack) (void *addr);
#endif
#if !defined(GRUB_UTIL) && NEED_REGISTER_FRAME_INFO
void EXPORT_FUNC (__register_frame_info) (void);
void EXPORT_FUNC (__deregister_frame_info) (void);