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 <kette...@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.