Add non-exec trampoline stub (mprotect stack).

Fixes ada build.
This commit is contained in:
espie 2002-08-30 08:33:14 +00:00
parent 97d7fd758e
commit 65931f1edc
5 changed files with 42 additions and 8 deletions

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-gcc_config_i386_i386_c,v 1.3 2002/08/30 08:33:14 espie Exp $
--- gcc/config/i386/i386.c.orig Thu Aug 29 19:29:08 2002
+++ gcc/config/i386/i386.c Thu Aug 29 20:37:55 2002
@@ -10808,6 +10808,9 @@ x86_initialize_trampoline (tramp, fnaddr
if (offset > TRAMPOLINE_SIZE)
abort ();
}
+#ifdef FINALIZE_TRAMPOLINE
+ FINALIZE_TRAMPOLINE (tramp);
+#endif
}
#define def_builtin(MASK, NAME, TYPE, CODE) \

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-gcc_config_i386_openbsd_h,v 1.4 2002/05/27 16:58:29 espie Exp $
$OpenBSD: patch-gcc_config_i386_openbsd_h,v 1.5 2002/08/30 08:33:14 espie Exp $
--- gcc/config/i386/openbsd.h.orig Wed Oct 17 03:39:47 2001
+++ gcc/config/i386/openbsd.h Fri May 17 02:23:03 2002
@@ -95,26 +95,11 @@ Boston, MA 02111-1307, USA. */
+++ gcc/config/i386/openbsd.h Thu Aug 29 20:40:53 2002
@@ -95,26 +95,32 @@ Boston, MA 02111-1307, USA. */
#undef ASM_PREFERRED_EH_DATA_FORMAT
@ -30,3 +30,24 @@ $OpenBSD: patch-gcc_config_i386_openbsd_h,v 1.4 2002/05/27 16:58:29 espie Exp $
+/* OpenBSD gas currently does not support quad, so do not use it. */
+#undef ASM_QUAD
+
+#undef FINALIZE_TRAMPOLINE
+#define FINALIZE_TRAMPOLINE(TRAMP) \
+ emit_library_call(gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"), \
+ 0, VOIDmode, 1, memory_address (SImode, (TRAMP)), Pmode)
+
+#define TRANSFER_FROM_TRAMPOLINE \
+extern void __enable_execute_stack (void *); \
+void \
+__enable_execute_stack (addr) \
+ void *addr; \
+{ \
+ long size = getpagesize (); \
+ long mask = ~(size-1); \
+ char *page = (char *) (((long) addr) & mask); \
+ char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
+ \
+ /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \
+ if (mprotect (page, end - page, 7) < 0) \
+ perror ("mprotect of trampoline code"); \
+}

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-libstdc++-v3_config_cpu_m68k_bits_atomicity_h,v 1.2 2002/06/09 00:35:38 espie Exp $
$OpenBSD: patch-libstdc++-v3_config_cpu_m68k_bits_atomicity_h,v 1.3 2002/08/30 08:33:14 espie Exp $
--- libstdc++-v3/config/cpu/m68k/bits/atomicity.h.orig Thu Feb 14 19:57:38 2002
+++ libstdc++-v3/config/cpu/m68k/bits/atomicity.h Sat Jun 8 14:43:40 2002
+++ libstdc++-v3/config/cpu/m68k/bits/atomicity.h Thu Aug 29 20:55:10 2002
@@ -45,7 +45,7 @@ __exchange_and_add (volatile _Atomic_wor
__asm__ __volatile__ ("1: move%.l %0,%1\n\t"
"add%.l %2,%1\n\t"

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-libstdc++-v3_configure_in,v 1.6 2002/06/09 00:35:38 espie Exp $
$OpenBSD: patch-libstdc++-v3_configure_in,v 1.7 2002/08/30 08:33:14 espie Exp $
--- libstdc++-v3/configure.in.orig Wed May 8 06:27:59 2002
+++ libstdc++-v3/configure.in Sat Jun 8 14:43:40 2002
+++ libstdc++-v3/configure.in Thu Aug 29 20:55:10 2002
@@ -247,7 +247,7 @@ else
# Check for available headers.

View File

@ -1,5 +1,5 @@
--- libstdc++-v3/src/Makefile.in.orig Tue Apr 2 04:47:04 2002
+++ libstdc++-v3/src/Makefile.in Sat Jun 8 14:43:40 2002
+++ libstdc++-v3/src/Makefile.in Thu Aug 29 20:55:10 2002
@@ -154,7 +154,7 @@ mkinstalldirs = $(SHELL) $(toplevel_srcd
CXX = @glibcpp_CXX@
toolexecdir = @glibcpp_toolexecdir@