diff -uraN libgc-6.8.orig/configure.in libgc-6.8/configure.in
--- libgc-6.8.orig/configure.in	2009-01-21 23:04:16.000000000 +0000
+++ libgc-6.8/configure.in	2009-01-21 22:27:59.987453982 +0000
@@ -133,6 +133,14 @@
 	AC_DEFINE(GC_SOLARIS_THREADS)
 	AC_DEFINE(GC_SOLARIS_PTHREADS)
 	;;
+     *-*-kopensolaris*-gnu)
+	AC_DEFINE(GC_KOPENSOLARIS_THREADS)
+	AC_DEFINE(_REENTRANT)
+        if test "${enable_parallel_mark}" = yes; then
+	  AC_DEFINE(PARALLEL_MARK)
+	fi
+	AC_DEFINE(THREAD_LOCAL_ALLOC)
+	;;
      *-*-irix*)
 	AC_DEFINE(GC_IRIX_THREADS)
 	;;
diff -uraN libgc-6.8.orig/dyn_load.c libgc-6.8/dyn_load.c
--- libgc-6.8.orig/dyn_load.c	2006-06-07 05:01:52.000000000 +0000
+++ libgc-6.8/dyn_load.c	2009-01-21 23:07:39.975055258 +0000
@@ -58,7 +58,7 @@
     !defined(RS6000) && !defined(SCO_ELF) && !defined(DGUX) && \
     !(defined(FREEBSD) && defined(__ELF__)) && \
     !(defined(NETBSD) && defined(__ELF__)) && !defined(HURD) && \
-    !defined(DARWIN)
+    !defined(DARWIN) && !defined(KOPENSOLARIS)
  --> We only know how to find data segments of dynamic libraries for the
  --> above.  Additional SVR4 variants might not be too
  --> hard to add.
@@ -87,7 +87,8 @@
 
 #if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
     (defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \
-    (defined(NETBSD) && defined(__ELF__)) || defined(HURD)
+    (defined(NETBSD) && defined(__ELF__)) || defined(HURD) || \
+    defined(KOPENSOLARIS)
 #   include <stddef.h>
 #   include <elf.h>
 #   include <link.h>
@@ -287,7 +288,8 @@
 
 #if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
     (defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \
-    (defined(NETBSD) && defined(__ELF__)) || defined(HURD)
+    (defined(NETBSD) && defined(__ELF__)) || defined(HURD) || \
+    defined(KOPENSOLARIS)
 
 
 #ifdef USE_PROC_FOR_LIBRARIES
diff -uraN libgc-6.8.orig/include/gc_config_macros.h libgc-6.8/include/gc_config_macros.h
--- libgc-6.8.orig/include/gc_config_macros.h	2006-03-10 22:15:43.000000000 +0000
+++ libgc-6.8/include/gc_config_macros.h	2009-01-21 22:30:37.296630475 +0000
@@ -62,7 +62,8 @@
 	defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) || \
 	defined(GC_DGUX386_THREADS) || defined(GC_DARWIN_THREADS) || \
         defined(GC_AIX_THREADS) || defined(GC_NETBSD_THREADS) || \
-        (defined(GC_WIN32_THREADS) && defined(__CYGWIN32__))
+        (defined(GC_WIN32_THREADS) && defined(__CYGWIN32__)) || \
+        defined(GC_KOPENSOLARIS_THREADS)
 #   define GC_PTHREADS
 # endif
 
diff -uraN libgc-6.8.orig/include/private/gcconfig.h libgc-6.8/include/private/gcconfig.h
--- libgc-6.8.orig/include/private/gcconfig.h	2009-01-21 23:04:16.000000000 +0000
+++ libgc-6.8/include/private/gcconfig.h	2009-01-21 22:56:00.348807872 +0000
@@ -1,3 +1,6 @@
+#ifndef __GLIBC__
+# define __GLIBC__
+#endif
 /* 
  * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
  * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
@@ -159,6 +162,12 @@
 #    define SOLARIS
 #    define mach_type_known
 # endif
+# if defined(__OpenSolaris_kernel__) && (defined(i386) || defined(__i386__))
+#    define I386
+#    define KOPENSOLARIS
+#    define SUNOS5SIGS
+#    define mach_type_known
+# endif
 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
 #    define I386
 #    define OS2
@@ -1061,7 +1070,7 @@
       extern int etext[];
 #     define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
 #   endif
-#   ifdef SUNOS5
+#   if defined(SUNOS5) || defined(KOPENSOLARIS)
 #	define OS_TYPE "SUNOS5"
         extern int _etext[], _end[];
   	extern ptr_t GC_SysVGetDataStart();
@@ -1131,7 +1140,7 @@
 #	endif /* USE_MMAP */
 #   endif /* DGUX */
 
-#   ifdef LINUX
+#   if defined(LINUX)
 #	ifndef __GNUC__
 	  /* The Intel compiler doesn't like inline assembly */
 #	  define USE_GENERIC_PUSH_REGS
@@ -2154,7 +2163,8 @@
 # if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
 	    || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
 	    || defined(DGUX) || defined(BSD) || defined(SUNOS4) \
-	    || defined(_AIX) || defined(DARWIN) || defined(OSF1)
+	    || defined(_AIX) || defined(DARWIN) || defined(OSF1) \
+	    || defined(KOPENSOLARIS)
 #   define UNIX_LIKE   /* Basic Unix-like system calls work.	*/
 # endif
 
diff -uraN libgc-6.8.orig/os_dep.c libgc-6.8/os_dep.c
--- libgc-6.8.orig/os_dep.c	2006-04-21 23:26:47.000000000 +0000
+++ libgc-6.8/os_dep.c	2009-01-21 23:03:51.920637856 +0000
@@ -80,7 +80,8 @@
 # endif
 
 # if (defined(SVR4) || defined(AUX) || defined(DGUX) \
-      || (defined(LINUX) && defined(SPARC))) && !defined(PCR)
+      || (defined(LINUX) && defined(SPARC))) || defined(KOPENSOLARIS) \
+      && !defined(PCR)
 #   define NEED_FIND_LIMIT
 # endif
 
@@ -1359,7 +1360,8 @@
 # else /* !OS2 && !Windows */
 
 # if (defined(SVR4) || defined(AUX) || defined(DGUX) \
-      || (defined(LINUX) && defined(SPARC))) && !defined(PCR)
+      || (defined(LINUX) && defined(SPARC))) || defined(KOPENSOLARIS) \
+      && !defined(PCR)
 ptr_t GC_SysVGetDataStart(max_page_size, etext_addr)
 int max_page_size;
 int * etext_addr;
@@ -2251,7 +2253,7 @@
 #endif /* SUNOS4 || (FREEBSD && !SUNOS5SIGS) */
 
 #if defined(SUNOS5SIGS) || defined(OSF1) || defined(LINUX) \
-    || defined(HURD)
+    || defined(HURD) || defined(KOPENSOLARIS)
 # ifdef __STDC__
     typedef void (* SIG_PF)(int);
 # else
diff -uraN libgc-6.8.orig/pthread_support.c libgc-6.8/pthread_support.c
--- libgc-6.8.orig/pthread_support.c	2006-06-28 22:38:42.000000000 +0000
+++ libgc-6.8/pthread_support.c	2009-01-21 22:53:58.569984905 +0000
@@ -68,7 +68,7 @@
 
 # if (defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) || \
       defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) || \
-      defined(GC_NETBSD_THREADS))			       \
+      defined(GC_NETBSD_THREADS)) || defined(GC_KOPENSOLARIS_THREADS) \
       && !defined(USE_PTHREAD_SPECIFIC)
 #   define USE_PTHREAD_SPECIFIC
 # endif
@@ -899,7 +899,8 @@
 #       if defined(GC_HPUX_THREADS)
 	  GC_nprocs = pthread_num_processors_np();
 #       endif
-#	if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS)
+#	if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) || \
+       defined(GC_KOPENSOLARIS_THREADS)
 	  GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN);
 	  if (GC_nprocs <= 0) GC_nprocs = 1;
 #	endif

