$OpenBSD: patch-gc_dyn_load_c,v 1.2 2002/04/07 00:50:36 brad Exp $
--- gc/dyn_load.c.orig	Wed Dec 19 19:37:29 2001
+++ gc/dyn_load.c	Sun Mar 10 02:30:27 2002
@@ -57,7 +57,9 @@
     !defined(HPUX) && !(defined(LINUX) && defined(__ELF__)) && \
     !defined(RS6000) && !defined(SCO_ELF) && \
     !(defined(FREEBSD) && defined(__ELF__)) && \
-    !(defined(NETBSD) && defined(__ELF__)) && !defined(HURD)
+    !(defined(NETBSD) && defined(__ELF__)) && \
+    !(defined(OPENBSD) && defined(__ELF__)) && \
+    !defined(HURD)
  --> We only know how to find data segments of dynamic libraries for the
  --> above.  Additional SVR4 variants might not be too
  --> hard to add.
@@ -248,7 +250,9 @@ void GC_register_dynamic_libraries()
 
 #if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
     (defined(FREEBSD) && defined(__ELF__)) || \
-    (defined(NETBSD) && defined(__ELF__)) || defined(HURD)
+    (defined(NETBSD) && defined(__ELF__)) || \
+    (defined(OPENBSD) && defined(__ELF__)) || \
+    defined(HURD)
 
 
 #ifdef USE_PROC_FOR_LIBRARIES
@@ -429,14 +433,14 @@ static char *parse_map_entry(char *buf_p
 /* For glibc 2.2.4+.  Unfortunately, it doesn't work for older	*/
 /* versions.  Thanks to Jakub Jelinek for most of the code.	*/
 
-#include <stddef.h>
-#include <elf.h>
-#include <link.h>
-
 # if defined(LINUX) /* Are others OK here, too? */ \
      && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
          || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG))) 
 
+#include <stddef.h>
+#include <elf.h>
+#include <link.h>
+
 /* We have the header files for a glibc that includes dl_iterate_phdr.	*/
 /* It may still not be available in the library on the target system.   */
 /* Thus we also treat it as a weak symbol.				*/
@@ -507,7 +511,7 @@ GC_bool GC_register_dynamic_libraries_dl
 /* This doesn't necessarily work in all cases, e.g. with preloaded
  * dynamic libraries.						*/
 
-#if defined(NETBSD)
+#if defined(NETBSD) || defined(OPENBSD)
 #  include <sys/exec_elf.h>
 #else
 #  include <elf.h>
