$OpenBSD: patch-gcc_config_rs6000_sysv4_h,v 1.2 2021/01/18 19:31:43 kettenis Exp $
Index: gcc/config/rs6000/sysv4.h
--- gcc/config/rs6000/sysv4.h.orig
+++ gcc/config/rs6000/sysv4.h
@@ -87,7 +87,8 @@ do {									\
   else if (!strcmp (rs6000_abi_name, "aixdesc"))			\
     rs6000_current_abi = ABI_AIX;					\
   else if (!strcmp (rs6000_abi_name, "freebsd")				\
-	   || !strcmp (rs6000_abi_name, "linux"))			\
+	   || !strcmp (rs6000_abi_name, "linux")			\
+	   || !strcmp (rs6000_abi_name, "openbsd"))			\
     {									\
       if (TARGET_64BIT)							\
 	rs6000_current_abi = ABI_AIX;					\
@@ -96,8 +97,6 @@ do {									\
     }									\
   else if (!strcmp (rs6000_abi_name, "netbsd"))				\
     rs6000_current_abi = ABI_V4;					\
-  else if (!strcmp (rs6000_abi_name, "openbsd"))			\
-    rs6000_current_abi = ABI_V4;					\
   else if (!strcmp (rs6000_abi_name, "i960-old"))			\
     {									\
       rs6000_current_abi = ABI_V4;					\
@@ -387,6 +386,7 @@ do {									\
   asm_fprintf (FILE, "%L%s", PREFIX)
 
 /* Globalizing directive for a label.  */
+#undef GLOBAL_ASM_OP
 #define GLOBAL_ASM_OP "\t.globl "
 
 /* This says how to output assembler code to declare an
@@ -851,13 +851,14 @@ ncrtn.o%s"
 
 /* OpenBSD support.  */
 #ifndef	LIB_OPENBSD_SPEC
-#define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
+#define LIB_OPENBSD_SPEC OBSD_LIB_SPEC
 #endif
 
 #ifndef	STARTFILE_OPENBSD_SPEC
 #define	STARTFILE_OPENBSD_SPEC "\
-%{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
-%{!shared: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}"
 #endif
 
 #ifndef	ENDFILE_OPENBSD_SPEC
@@ -874,7 +875,7 @@ ncrtn.o%s"
 #endif
 
 #ifndef CPP_OS_OPENBSD_SPEC
-#define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
+#define CPP_OS_OPENBSD_SPEC OBSD_CPP_SPEC
 #endif
 
 /* Define any extra SPECS that the compiler needs to generate.  */
