This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix nested function support on OpenBSD/hppa
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: gcc-patches at gcc dot gnu dot org
- Cc: dave dot anglin at nrc-cnrc dot gc dot ca
- Date: Thu, 25 Jul 2013 12:00:20 +0200 (CEST)
- Subject: [PATCH] Fix nested function support on OpenBSD/hppa
On OpenBSD/hppa the stack is protected against execution in the same
way as on many other architectures. The diff below makes GCC emit the
call that's needed to "unprotect" the stack such that the magic
trampolines needed for execution of nested functions work.
2013-07-25 Mark Kettenis <kettenis@openbsd.org>
* config/pa/pa.c (pa_trampoline_init): Emit __enable_execute_stack
libcall if HAVE_ENABLE_EXECUTE_STACK is defined.
Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c (revision 201041)
+++ config/pa/pa.c (working copy)
@@ -10133,6 +10133,11 @@
gen_reg_rtx (Pmode),
gen_reg_rtx (Pmode)));
}
+
+#ifdef HAVE_ENABLE_EXECUTE_STACK
+ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"),
+ LCT_NORMAL, VOIDmode, 1, XEXP (m_tramp, 0), Pmode);
+#endif
}
/* Perform any machine-specific adjustment in the address of the trampoline.