[PATCH] Fix nested function support on OpenBSD/hppa

Mark Kettenis mark.kettenis@xs4all.nl
Thu Jul 25 10:12:00 GMT 2013

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)));
+  emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"),
+		     LCT_NORMAL, VOIDmode, 1, XEXP (m_tramp, 0), Pmode);
 /* Perform any machine-specific adjustment in the address of the trampoline.

More information about the Gcc-patches mailing list