--- include/private/gcconfig.h.orig	Fri Jun 29 01:00:09 2007
+++ include/private/gcconfig.h	Fri Jul 13 20:11:10 2007
@@ -64,7 +64,7 @@
 /* Determine the machine type: */
 # if defined(__arm__) || defined(__thumb__)
 #    define ARM32
-#    if !defined(LINUX) && !defined(NETBSD)
+#    if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD)
 #      define NOSYS
 #      define mach_type_known
 #    endif
@@ -83,6 +83,10 @@
 #    define SPARC
 #    define mach_type_known
 # endif
+# if defined(OPENBSD) && defined(__arm__)
+#    define ARM32
+#    define mach_type_known
+# endif
 # if defined(NETBSD) && (defined(m68k) || defined(__m68k__))
 #    define M68K
 #    define mach_type_known
@@ -99,7 +103,7 @@
 #    define SH
 #    define mach_type_known
 # endif
-# if defined(vax)
+# if defined(vax) || defined(__vax__)
 #    define VAX
 #    ifdef ultrix
 #	define ULTRIX
@@ -219,6 +223,10 @@
 #    define I386
 #    define mach_type_known
 # endif
+# if defined(OPENBSD) && defined(__amd64__)
+#    define X86_64
+#    define mach_type_known
+# endif
 # if defined(LINUX) && defined(__x86_64__)
 #    define X86_64
 #    define mach_type_known
@@ -290,6 +298,16 @@
 #   define MACOS
 #   define mach_type_known
 # endif
+# if defined(__OpenBSD__) && (defined(__powerpc__))
+#   define POWERPC
+#   define OPENBSD
+#   define mach_type_known
+# endif
+# if defined(__OpenBSD__) && (defined(__mc68020__) || defined(__mc68020))
+#   define M68K
+#   define OPENBSD
+#   define mach_type_known
+# endif
 # if defined(macosx) || (defined(__APPLE__) && defined(__MACH__))
 #   define DARWIN
 #   if defined(__ppc__)  || defined(__ppc64__)
@@ -358,6 +376,10 @@
     /* DGUX defined */
 #   define mach_type_known
 # endif
+# if defined(OPENBSD) && defined(__m88k__)
+#   define M88K
+#   define mach_type_known
+# endif
 # if defined(_WIN32_WCE)
     /* SH3, SH4, MIPS already defined for corresponding architectures */
 #   if defined(SH3) || defined(SH4)
@@ -647,14 +669,22 @@
 #   define ALIGNMENT 2
 #   ifdef OPENBSD
 #	define OS_TYPE "OPENBSD"
-#	define HEURISTIC2
-#	ifdef __ELF__
-#	  define DATASTART GC_data_start
-#	  define DYNAMIC_LOADING
-#	else
-	  extern char etext[];
-#	  define DATASTART ((ptr_t)(etext))
-#       endif
+#       define HAVE_PUSH_REGS
+#    ifdef GC_OPENBSD_THREADS
+#       define SIG_SUSPEND SIGUSR1
+#       define SIG_THR_RESTART SIGUSR2
+#    else
+#       include <sys/param.h>
+#       include <uvm/uvm_extern.h>
+#       define STACKBOTTOM USRSTACK
+#    endif
+        extern char *__progname[];
+#       define DATASTART ((ptr_t)&__progname)
+#       define DATAEND GC_data_end1
+#	define DATASTART2 GC_data_start2
+        extern char _end[];
+#	define DATAEND2 ((ptr_t)(&_end))
+#       define DYNAMIC_LOADING
 #   endif
 #   ifdef NETBSD
 #	define OS_TYPE "NETBSD"
@@ -788,6 +818,25 @@
 	 should be looked into some more */
 #     define NO_PTHREAD_TRYLOCK
 #   endif
+#   ifdef OPENBSD
+#     define OS_TYPE "OPENBSD"
+#     define ALIGNMENT 4
+#     ifdef GC_OPENBSD_THREADS
+#       define SIG_SUSPEND SIGUSR1
+#       define SIG_THR_RESTART SIGUSR2
+#     else
+#       include <sys/param.h>
+#       include <uvm/uvm_extern.h>
+#       define STACKBOTTOM USRSTACK
+#     endif
+      extern char *__progname[];
+#     define DATASTART ((ptr_t)&__progname)
+#     define DATAEND GC_data_end1
+#     define DATASTART2 GC_data_start2
+      extern char _end[];
+#     define DATAEND2 ((ptr_t)(&_end))
+#     define DYNAMIC_LOADING
+#   endif
 #   ifdef FREEBSD
 #       define ALIGNMENT 4
 #       define OS_TYPE "FREEBSD"
@@ -955,9 +1004,21 @@
 #   endif
 #   ifdef OPENBSD
 #     define OS_TYPE "OPENBSD"
-#     define STACKBOTTOM ((ptr_t) 0xf8000000)
-      extern int etext[];
-#     define DATASTART ((ptr_t)(etext))
+#     ifdef GC_OPENBSD_THREADS
+#       define SIG_SUSPEND SIGUSR1
+#       define SIG_THR_RESTART SIGUSR2
+#     else
+#       include <sys/param.h>
+#       include <uvm/uvm_extern.h>
+#       define STACKBOTTOM USRSTACK
+#     endif
+      extern char *__progname[];
+#     define DATASTART ((ptr_t)&__progname)
+#     define DATAEND GC_data_end1
+#     define DATASTART2 GC_data_start2
+      extern char _end[];
+#     define DATAEND2 ((ptr_t)(&_end))
+#     define DYNAMIC_LOADING
 #   endif
 #   ifdef NETBSD
 #     define OS_TYPE "NETBSD"
@@ -1203,6 +1264,21 @@
 #   endif
 #   ifdef OPENBSD
 #	define OS_TYPE "OPENBSD"
+#    ifdef GC_OPENBSD_THREADS
+#       define SIG_SUSPEND SIGUSR1
+#       define SIG_THR_RESTART SIGUSR2
+#    else
+#       include <sys/param.h>
+#       include <uvm/uvm_extern.h>
+#       define STACKBOTTOM USRSTACK
+#    endif
+        extern char *__progname[];
+#       define DATASTART ((ptr_t)&__progname)
+#       define DATAEND GC_data_end1
+#	define DATASTART2 GC_data_start2
+        extern char _end[];
+#	define DATAEND2 ((ptr_t)(&_end))
+#       define DYNAMIC_LOADING
 #   endif
 #   ifdef FREEBSD
 #	define OS_TYPE "FREEBSD"
@@ -1238,7 +1314,7 @@
 #   ifdef BSDI
 #	define OS_TYPE "BSDI"
 #   endif
-#   if defined(OPENBSD) || defined(NETBSD) \
+#   if defined(NETBSD) \
         || defined(THREE86BSD) || defined(BSDI)
 #	define HEURISTIC2
 	extern char etext[];
@@ -1489,15 +1565,22 @@
 #   endif
 #   ifdef OPENBSD
 #	define OS_TYPE "OPENBSD"
-#	define HEURISTIC2
-#   	ifdef __ELF__	/* since OpenBSD/Alpha 2.9 */
-#	   define DATASTART GC_data_start
-#   	   define ELFCLASS32 32
-#   	   define ELFCLASS64 64
-#   	   define ELF_CLASS ELFCLASS64
-#       else		/* ECOFF, until OpenBSD/Alpha 2.7 */
-#   	   define DATASTART ((ptr_t) 0x140000000)
-#   	endif
+#	define ELF_CLASS ELFCLASS64
+#    ifdef GC_OPENBSD_THREADS
+#       define SIG_SUSPEND SIGUSR1
+#       define SIG_THR_RESTART SIGUSR2
+#    else
+#       include <sys/param.h>
+#       include <uvm/uvm_extern.h>
+#       define STACKBOTTOM USRSTACK
+#    endif
+        extern char *__progname[];
+#       define DATASTART ((ptr_t)&__progname)
+#       define DATAEND GC_data_end1
+#	define DATASTART2 GC_data_start2
+        extern char _end[];
+#	define DATAEND2 ((ptr_t)(&_end))
+#       define DYNAMIC_LOADING
 #   endif
 #   ifdef FREEBSD
 #	define OS_TYPE "FREEBSD"
@@ -1662,9 +1745,28 @@
 #   define MACH_TYPE "M88K"
 #   define ALIGNMENT 4
     extern int etext[];
+#   ifdef OPENBSD
+#	define OS_TYPE "OPENBSD"
+#    ifdef GC_OPENBSD_THREADS
+#       define SIG_SUSPEND SIGUSR1
+#       define SIG_THR_RESTART SIGUSR2
+#    else
+#       include <sys/param.h>
+#       include <uvm/uvm_extern.h>
+#       define STACKBOTTOM USRSTACK
+#    endif
+        extern char *__progname[];
+#       define DATASTART ((ptr_t)&__progname)
+#       define DATAEND GC_data_end1
+#	define DATASTART2 GC_data_start2
+        extern char _end[];
+#	define DATAEND2 ((ptr_t)(&_end))
+#       define DYNAMIC_LOADING
+#   endif
 #   ifdef CX_UX
 #	define OS_TYPE "CX_UX"
-#       define DATASTART ((((word)etext + 0x3fffff) & ~0x3fffff) + 0x10000)
+//#       define DATASTART ((((word)etext + 0x3fffff) & ~0x3fffff) + 0x10000)
+#       define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
 #   endif
 #   ifdef  DGUX
 #	define OS_TYPE "DGUX"
@@ -1764,6 +1866,25 @@
 #     define OS_TYPE "MSWINCE"
 #     define DATAEND /* not needed */
 #   endif
+#   ifdef OPENBSD
+#     define ALIGNMENT 4
+#     define OS_TYPE "OPENBSD"
+#    ifdef GC_OPENBSD_THREADS
+#       define SIG_SUSPEND SIGUSR1
+#       define SIG_THR_RESTART SIGUSR2
+#    else
+#       include <sys/param.h>
+#       include <uvm/uvm_extern.h>
+#       define STACKBOTTOM USRSTACK
+#    endif
+        extern char *__progname[];
+#       define DATASTART ((ptr_t)&__progname)
+#       define DATAEND GC_data_end1
+#	define DATASTART2 GC_data_start2
+        extern char _end[];
+#	define DATAEND2 ((ptr_t)(&_end))
+#       define DYNAMIC_LOADING
+#   endif
 #   ifdef NOSYS
       /* __data_start is usually defined in the target linker script.  */
       extern int __data_start[];
@@ -1838,6 +1959,25 @@
 #   define CPP_WORDSZ 64
 #   ifndef HBLKSIZE
 #     define HBLKSIZE 4096
+#   endif
+#   ifdef OPENBSD
+#       define OS_TYPE "OPENBSD"
+#       define ELF_CLASS ELFCLASS64
+#    ifdef GC_OPENBSD_THREADS
+#       define SIG_SUSPEND SIGUSR1
+#       define SIG_THR_RESTART SIGUSR2
+#    else
+#       include <sys/param.h>
+#       include <uvm/uvm_extern.h>
+#       define STACKBOTTOM USRSTACK
+#    endif
+        extern char *__progname[];
+#       define DATASTART ((ptr_t)&__progname)
+#       define DATAEND GC_data_end1
+#	define DATASTART2 GC_data_start2
+        extern char _end[];
+#	define DATAEND2 ((ptr_t)(&_end))
+#       define DYNAMIC_LOADING
 #   endif
 #   define CACHE_LINE_SIZE 64
 #   ifdef LINUX
