diff -ru gc-7.2alpha6-orig/configure.ac gc-7.2alpha6/configure.ac
--- gc-7.2alpha6-orig/configure.ac	2011-06-14 12:34:55.000000000 +0000
+++ gc-7.2alpha6/configure.ac	2012-03-16 00:46:16.500695040 +0000
@@ -83,6 +83,7 @@
 AH_TEMPLATE([GC_DARWIN_THREADS],    [Define to support Darwin pthreads.])
 AH_TEMPLATE([GC_FREEBSD_THREADS],   [Define to support FreeBSD pthreads.])
 AH_TEMPLATE([GC_GNU_THREADS],       [Define to support GNU pthreads.])
+AH_TEMPLATE([GC_HAIKU_THREADS],     [Define to support Haiku pthreads.])
 AH_TEMPLATE([GC_HPUX_THREADS],      [Define to support HP/UX 11 pthreads.])
 AH_TEMPLATE([GC_IRIX_THREADS],      [Define to support Irix pthreads.])
 AH_TEMPLATE([GC_LINUX_THREADS],     [Define to support pthreads on Linux.])
@@ -127,6 +128,10 @@
         AC_DEFINE(GC_AIX_THREADS)
         AC_DEFINE(_REENTRANT)
         ;;
+     *-*-haiku*)
+        AC_DEFINE(GC_HAIKU_THREADS)
+        AC_DEFINE(_REENTRANT)
+        ;;
      *-*-hpux11*)
         AC_MSG_WARN("Only HP/UX 11 POSIX threads are supported.")
         AC_DEFINE(GC_HPUX_THREADS)
diff -ru gc-7.2alpha6-orig/dyn_load.c gc-7.2alpha6/dyn_load.c
--- gc-7.2alpha6-orig/dyn_load.c	2011-05-31 15:27:11.000000000 +0000
+++ gc-7.2alpha6/dyn_load.c	2012-03-23 22:11:06.758906880 +0000
@@ -63,7 +63,7 @@
     !(defined(FREEBSD) && defined(__ELF__)) && \
     !(defined(OPENBSD) && (defined(__ELF__) || defined(M68K))) && \
     !(defined(NETBSD) && defined(__ELF__)) && !defined(HURD) && \
-    !defined(DARWIN) && !defined(CYGWIN32)
+    !defined(DARWIN) && !defined(CYGWIN32) && !defined(HAIKU)
  --> We only know how to find data segments of dynamic libraries for the
  --> above.  Additional SVR4 variants might not be too
  --> hard to add.
@@ -1419,6 +1419,22 @@
 
 #endif /* DARWIN */
 
+#ifdef HAIKU
+#include <kernel/image.h>
+
+GC_INNER void GC_register_dynamic_libraries()
+{
+    image_info info;
+    int32 cookie = 0;
+    while (get_next_image_info(0, &cookie, &info) == B_OK)
+    {
+        void *data = info.data;
+        GC_add_roots_inner(data, data + info.data_size, TRUE);
+    }
+}
+
+#endif /* HAIKU */
+
 #elif defined(PCR)
 
 # include "il/PCR_IL.h"
diff -ru gc-7.2alpha6-orig/include/gc_config_macros.h gc-7.2alpha6/include/gc_config_macros.h
--- gc-7.2alpha6-orig/include/gc_config_macros.h	2011-04-24 13:09:21.000000000 +0000
+++ gc-7.2alpha6/include/gc_config_macros.h	2012-03-16 00:44:30.556793856 +0000
@@ -65,7 +65,7 @@
     || defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) \
     || defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) \
     || defined(GC_OSF1_THREADS) || defined(GC_SOLARIS_THREADS) \
-    || defined(GC_WIN32_THREADS)
+    || defined(GC_WIN32_THREADS) || defined(GC_HAIKU_THREADS)
 # ifndef GC_THREADS
 #   define GC_THREADS
 # endif
diff -ru gc-7.2alpha6-orig/include/private/config.h.in gc-7.2alpha6/include/private/config.h.in
--- gc-7.2alpha6-orig/include/private/config.h.in	2010-09-11 11:27:06.000000000 +0000
+++ gc-7.2alpha6/include/private/config.h.in	2012-03-16 00:49:30.038273024 +0000
@@ -45,6 +45,9 @@
 /* Define to support GNU pthreads. */
 #undef GC_GNU_THREADS
 
+/* Define to support Haiku pthreads. */
+#undef GC_HAIKU_THREADS
+
 /* Define if backtrace information is supported. */
 #undef GC_HAVE_BUILTIN_BACKTRACE
 
Only in gc-7.2alpha6/include/private: config.h.in~
diff -ru gc-7.2alpha6-orig/include/private/gcconfig.h gc-7.2alpha6/include/private/gcconfig.h
--- gc-7.2alpha6-orig/include/private/gcconfig.h	2011-05-31 15:27:12.000000000 +0000
+++ gc-7.2alpha6/include/private/gcconfig.h	2012-03-23 22:28:55.210501632 +0000
@@ -234,6 +234,11 @@
 #    define BEOS
 #    define mach_type_known
 # endif
+# if defined(__HAIKU__) && defined(_X86_)
+#    define I386
+#    define HAIKU
+#    define mach_type_known
+# endif
 # if defined(OPENBSD) && defined(__amd64__)
 #    define X86_64
 #    define mach_type_known
@@ -1110,6 +1115,15 @@
       extern int etext[];
 #     define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
 #   endif
+#   ifdef HAIKU
+#     define OS_TYPE "HAIKU"
+#     include <OS.h>
+#     define GETPAGESIZE() B_PAGE_SIZE
+      extern int etext[];
+#     define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
+#     define DYNAMIC_LOADING
+#     define MPROTECT_VDB
+#   endif
 #   ifdef SOLARIS
 #       define OS_TYPE "SOLARIS"
         extern int _etext[], _end[];
@@ -2345,7 +2359,7 @@
 #if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
     || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
     || defined(DGUX) || defined(BSD) || defined(HURD) \
-    || defined(AIX) || defined(DARWIN) || defined(OSF1)
+    || defined(AIX) || defined(DARWIN) || defined(OSF1) || defined(HAIKU)
 # define UNIX_LIKE      /* Basic Unix-like system calls work.   */
 #endif
 
@@ -2423,7 +2437,8 @@
 
 #if ((defined(UNIX_LIKE) && (defined(DARWIN) || defined(HURD) \
                              || defined(OPENBSD) || defined(ARM32) \
-                             || defined(MIPS) || defined(AVR32))) \
+                             || defined(MIPS) || defined(AVR32) \
+                             || defined(HAIKU))) \
      || (defined(LINUX) && (defined(SPARC) || defined(M68K))) \
      || (defined(RTEMS) && defined(I386))) && !defined(NO_GETCONTEXT)
 # define NO_GETCONTEXT
@@ -2721,6 +2736,9 @@
 # elif defined(SN_TARGET_PS3)
     void *ps3_get_mem(size_t size);
 #   define GET_MEM(bytes) (struct hblk*)ps3_get_mem(bytes)
+# elif defined(HAIKU)
+    ptr_t GC_haiku_get_mem(GC_word bytes);
+#   define GET_MEM(bytes) (struct hblk*)GC_haiku_get_mem(bytes)
 # else
     ptr_t GC_unix_get_mem(GC_word bytes);
 #   define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
diff -ru gc-7.2alpha6-orig/include/private/thread_local_alloc.h gc-7.2alpha6/include/private/thread_local_alloc.h
--- gc-7.2alpha6-orig/include/private/thread_local_alloc.h	2011-05-13 14:40:31.000000000 +0000
+++ gc-7.2alpha6/include/private/thread_local_alloc.h	2012-03-16 00:55:25.252706816 +0000
@@ -47,7 +47,7 @@
 #   define USE_COMPILER_TLS
 # elif 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_HAIKU_THREADS)
 #   define USE_PTHREAD_SPECIFIC
 # elif defined(GC_HPUX_THREADS)
 #   ifdef __GNUC__
diff -ru gc-7.2alpha6-orig/os_dep.c gc-7.2alpha6/os_dep.c
--- gc-7.2alpha6-orig/os_dep.c	2011-05-31 15:27:11.000000000 +0000
+++ gc-7.2alpha6/os_dep.c	2012-03-23 22:32:31.656932864 +0000
@@ -790,7 +790,7 @@
   }
 #endif /* !MSWIN32 */
 
-#ifdef BEOS
+#if defined(BEOS) || defined(HAIKU)
 # include <kernel/OS.h>
 
   GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb)
@@ -801,7 +801,7 @@
     return GC_SUCCESS;
   }
 # define HAVE_GET_STACK_BASE
-#endif /* BEOS */
+#endif /* BEOS || HAIKU */
 
 #ifdef OS2
   GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb)
@@ -1127,7 +1127,7 @@
 # define GET_MAIN_STACKBASE_SPECIAL
 #elif !defined(BEOS) && !defined(AMIGA) && !defined(OS2) \
       && !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) \
-      && !defined(GC_OPENBSD_THREADS) \
+      && !defined(GC_OPENBSD_THREADS) && !defined(HAIKU) \
       && (!defined(GC_SOLARIS_THREADS) || defined(_STRICT_STDC))
 
 # if defined(LINUX) && defined(USE_GET_STACKBASE_FOR_MAIN)
@@ -1977,7 +1977,7 @@
 # if !defined(OS2) && !defined(PCR) && !defined(AMIGA) && !defined(MSWIN32) \
      && !defined(MSWINCE) && !defined(MACOS) && !defined(DOS4GW) \
      && !defined(NONSTOP) && !defined(SN_TARGET_PS3) && !defined(RTEMS) \
-     && !defined(__CC_ARM)
+     && !defined(__CC_ARM) && !defined(HAIKU)
 
 # define SBRK_ARG_T ptrdiff_t
 
@@ -2302,6 +2302,19 @@
   }
 #endif
 
+#ifdef HAIKU
+#include <stdlib.h>
+
+ptr_t GC_haiku_get_mem(word bytes)
+{
+    void* mem;
+    if (posix_memalign(&mem, GC_page_size, bytes) == 0)
+        return mem;
+    else
+        return NULL;
+}
+#endif
+
 #ifdef USE_MUNMAP
 
 /* For now, this only works on Win32/WinCE and some Unix-like   */
@@ -2903,7 +2916,9 @@
 # elif !defined(MSWIN32) && !defined(MSWINCE)
 #   include <sys/mman.h>
 #   include <signal.h>
-#   include <sys/syscall.h>
+#   if !defined(HAIKU)
+#     include <sys/syscall.h>
+#   endif
 
 #   define PROTECT(addr, len) \
         if (mprotect((caddr_t)(addr), (size_t)(len), \
@@ -3062,6 +3077,8 @@
       /* Empirically c.trapno == 14, on IA32, but is that useful?       */
       /* Should probably consider alignment issues on other             */
       /* architectures.                                                 */
+#   elif defined(HAIKU)
+#     define CODE_OK TRUE
 #   elif defined(HPUX)
 #     define CODE_OK (si -> si_code == SEGV_ACCERR \
                       || si -> si_code == BUS_ADRERR \
diff -ru gc-7.2alpha6-orig/pthread_support.c gc-7.2alpha6/pthread_support.c
--- gc-7.2alpha6-orig/pthread_support.c	2011-05-31 15:27:11.000000000 +0000
+++ gc-7.2alpha6/pthread_support.c	2012-03-16 00:39:06.171442176 +0000
@@ -938,7 +938,8 @@
       GC_nprocs = pthread_num_processors_np();
 #   elif defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) \
          || defined(GC_SOLARIS_THREADS) || defined(GC_GNU_THREADS) \
-         || defined(PLATFORM_ANDROID) || defined(NACL)
+         || defined(PLATFORM_ANDROID) || defined(NACL) \
+         || defined(GC_HAIKU_THREADS)
       GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN);
       if (GC_nprocs <= 0) GC_nprocs = 1;
 #   elif defined(GC_IRIX_THREADS)
