grub2/0194-Remove-all-trampoline-support.-Add-Wtrampolines-when.patch
Peter Jones f74b50e380 Rebase to upstream, fix a pile of bugs. The usual.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-06-12 15:37:08 -04:00

203 lines
6.7 KiB
Diff

From 03cd56052af22492179742054c0e6c0382f85afb Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sun, 3 Mar 2013 15:57:30 +0100
Subject: [PATCH 194/482] Remove all trampoline support. Add
-Wtrampolines when present. Remove symbols used for trampolines to make
link fail if trampolines are present.
---
ChangeLog | 6 ++++++
conf/Makefile.common | 2 +-
config.h.in | 7 -------
configure.ac | 31 +++++++++++--------------------
grub-core/kern/misc.c | 8 --------
include/grub/libgcc.h | 8 --------
include/grub/misc.h | 4 ----
7 files changed, 18 insertions(+), 48 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e67ca9a..cacba37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
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
append out of its parent.
diff --git a/conf/Makefile.common b/conf/Makefile.common
index 75c0a5e..c185a55 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -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
diff --git a/config.h.in b/config.h.in
index 91afd98..621742c 100644
--- a/config.h.in
+++ b/config.h.in
@@ -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
diff --git a/configure.ac b/configure.ac
index 92b550a..038f429 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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.
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index c3203a0..6cb8f0e 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -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)
{
diff --git a/include/grub/libgcc.h b/include/grub/libgcc.h
index 956d639..ca0d577 100644
--- a/include/grub/libgcc.h
+++ b/include/grub/libgcc.h
@@ -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);
diff --git a/include/grub/misc.h b/include/grub/misc.h
index 33e6b73..11eeb22 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -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);
--
1.8.2.1