$OpenBSD: patch-libgc_dyn_load_c,v 1.1 2014/07/09 11:39:17 robert Exp $
--- libgc/dyn_load.c.orig	Tue Jul  8 11:42:14 2014
+++ libgc/dyn_load.c	Tue Jul  8 12:52:49 2014
@@ -91,6 +91,13 @@
 #   define ELFSIZE ARCH_ELFSIZE
 #endif
 
+#if defined(OPENBSD)
+# include <sys/param.h>
+# if OpenBSD >= 200519
+#   define HAVE_DL_ITERATE_PHDR
+# endif
+#endif /* OPENBSD */
+
 #if (defined(LINUX) || defined(NACL)) && defined(__ELF__) || defined(SCO_ELF) || \
     (defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \
     (defined(OPENBSD) && defined(__ELF__)) || \
@@ -394,9 +401,10 @@ GC_bool GC_register_main_static_data()
 /* For glibc 2.2.4+.  Unfortunately, it doesn't work for older	*/
 /* versions.  Thanks to Jakub Jelinek for most of the code.	*/
 
-# if (defined(LINUX) || defined(NACL)) /* Are others OK here, too? */ \
+# if ((defined(LINUX) || defined(NACL)) /* Are others OK here, too? */ \
      && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
-         || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG))) 
+         || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))) \
+     || defined(OPENBSD)
 
 /* 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.   */
@@ -439,7 +447,6 @@ static int GC_register_dynlib_callback(info, size, ptr
 /* Return TRUE if we succeed, FALSE if dl_iterate_phdr wasn't there. */
 
 #pragma weak dl_iterate_phdr
-
 GC_bool GC_register_dynamic_libraries_dl_iterate_phdr()
 {
   if (dl_iterate_phdr) {
