$OpenBSD: patch-gcc_config_pa_pa-openbsd_h,v 1.2 2019/05/20 14:59:05 pascal Exp $
Index: gcc/config/pa/pa-openbsd.h
--- gcc/config/pa/pa-openbsd.h.orig
+++ gcc/config/pa/pa-openbsd.h
@@ -138,14 +138,15 @@ along with GCC; see the file COPYING3.  If not see
    %{shared:-shared} %{R*} \
    %{static:-Bstatic} \
    %{!static:-Bdynamic} \
+   %{rdynamic:-export-dynamic} \
    %{assert*} \
-   -dynamic-linker /usr/libexec/ld.so"
+   %{!shared:%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}}"
 
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC "\
-	%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
-	crtbegin%O%s} %{shared:crtbeginS%O%s}"
-
+	%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} \
+	%{!p:%{!static:crt0%O%s} %{static:%{nopie:crt0%O%s} \
+	%{!nopie:rcrt0%O%s}}}} crtbegin%O%s} %{shared:crtbeginS%O%s}"
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
 
