diff -urw gc-7.2.orig/CMakeLists.txt gc-7.2/CMakeLists.txt --- gc-7.2.orig/CMakeLists.txt 2012-08-09 15:25:12.000000000 -0500 +++ gc-7.2/CMakeLists.txt 2012-10-13 16:23:05.089626000 -0500 @@ -140,6 +140,11 @@ ADD_DEFINITIONS("-D_REENTRANT") ADD_DEFINITIONS("-D_PTHREADS") ENDIF() + IF ( "HOST" MATCHES .*-.*-dragonfly.*) + ADD_DEFINITIONS("-DGC_DRAGONFLY_THREADS") + ADD_DEFINITIONS("-D_REENTRANT") + ADD_DEFINITIONS("-D_PTHREADS") + ENDIF() IF ( "HOST" MATCHES .*-.*-solaris.*) ADD_DEFINITIONS("-DGC_SOLARIS_THREADS") ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") diff -urw gc-7.2.orig/configure gc-7.2/configure --- gc-7.2.orig/configure 2012-08-09 15:25:12.000000000 -0500 +++ gc-7.2/configure 2012-10-13 16:20:05.062617000 -0500 @@ -5003,6 +5003,15 @@ THREADDLLIBS="-lpthread -lrt" ;; + *-*-dragonfly*) + $as_echo "#define GC_DRAGONFLY_THREADS 1" >>confdefs.h + + $as_echo "#define _REENTRANT 1" >>confdefs.h + + $as_echo "#define _PTHREADS 1" >>confdefs.h + + THREADDLLIBS="-lpthread -lrt" + ;; *-*-solaris*) $as_echo "#define GC_SOLARIS_THREADS 1" >>confdefs.h diff -urw gc-7.2.orig/dyn_load.c gc-7.2/dyn_load.c --- gc-7.2.orig/dyn_load.c 2012-08-09 15:25:13.000000000 -0500 +++ gc-7.2/dyn_load.c 2012-10-13 16:16:10.960939000 -0500 @@ -83,6 +83,10 @@ # define ELFSIZE ARCH_ELFSIZE #endif +#if defined(__DragonFly__) +# include +#endif + #if defined(SCO_ELF) || defined(DGUX) || defined(HURD) \ || (defined(__ELF__) && (defined(LINUX) || defined(FREEBSD) \ || defined(NETBSD) || defined(OPENBSD))) @@ -405,6 +409,13 @@ # define DL_ITERATE_PHDR_STRONG #endif +#if defined(__DragonFly__) + /* On the DragonFlyBSD system, any target system at major version FIXME */ + /* have dl_iterate_phdr; therefore, we need not make it weak as above. */ +# define HAVE_DL_ITERATE_PHDR +# define DL_ITERATE_PHDR_STRONG +#endif + #if defined(HAVE_DL_ITERATE_PHDR) # ifdef PT_GNU_RELRO @@ -646,7 +657,8 @@ return(0); } if( cachedResult == 0 ) { -# if defined(NETBSD) && defined(RTLD_DI_LINKMAP) +# if (defined(NETBSD) && defined(RTLD_DI_LINKMAP)) \ + || defined(__DragonFly__) struct link_map *lm = NULL; if (!dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &lm)) cachedResult = lm; diff -urw gc-7.2.orig/extra/threadlibs.c gc-7.2/extra/threadlibs.c --- gc-7.2.orig/extra/threadlibs.c 2012-08-09 15:25:13.000000000 -0500 +++ gc-7.2/extra/threadlibs.c 2012-10-13 16:23:32.885602000 -0500 @@ -49,7 +49,7 @@ printf("-pthread\n"); # endif # endif -# if defined(GC_NETBSD_THREADS) +# if defined(GC_NETBSD_THREADS) || defined(GC_DRAGONFLY_THREADS) printf("-lpthread -lrt\n"); # endif diff -urw gc-7.2.orig/include/gc_config_macros.h gc-7.2/include/gc_config_macros.h --- gc-7.2.orig/include/gc_config_macros.h 2012-08-09 15:25:13.000000000 -0500 +++ gc-7.2/include/gc_config_macros.h 2012-10-13 16:30:50.679991000 -0500 @@ -67,8 +67,9 @@ || defined(GC_GNU_THREADS) || defined(GC_HPUX_THREADS) \ || 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_RTEMS_PTHREADS) + || defined(GC_DRAGONFLY_THREADS) || defined(GC_OSF1_THREADS) \ + || defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) \ + || defined(GC_RTEMS_PTHREADS) # ifndef GC_THREADS # define GC_THREADS # endif @@ -99,8 +100,10 @@ && !defined(GC_OSF1_THREADS) && !defined(GC_IRIX_THREADS) /* FIXME: Should we really need for FreeBSD and NetBSD to check */ /* that no other GC_xxx_THREADS macro is set? */ -# if defined(__FreeBSD__) || defined(__DragonFly__) +# if defined(__FreeBSD__) # define GC_FREEBSD_THREADS +# elif defined(__DragonFly__) +# define GC_DRAGONFLY_THREADS # elif defined(__NetBSD__) # define GC_NETBSD_THREADS # endif @@ -131,7 +134,8 @@ # define GC_PTHREADS #endif -#if !defined(_PTHREADS) && defined(GC_NETBSD_THREADS) +#if !defined(_PTHREADS) \ + && (defined(GC_NETBSD_THREADS) || defined(GC_DRAGONFLY_THREADS)) # define _PTHREADS #endif diff -urw gc-7.2.orig/include/private/config.h.in gc-7.2/include/private/config.h.in --- gc-7.2.orig/include/private/config.h.in 2012-08-09 15:25:13.000000000 -0500 +++ gc-7.2/include/private/config.h.in 2012-10-13 16:29:14.313420000 -0500 @@ -63,6 +63,9 @@ /* Define to support NetBSD pthreads. */ #undef GC_NETBSD_THREADS +/* Define to support DragonFly pthreads. */ +#undef GC_DRAGONFLY_THREADS + /* Define to support OpenBSD pthreads. */ #undef GC_OPENBSD_THREADS diff -urw gc-7.2.orig/include/private/gcconfig.h gc-7.2/include/private/gcconfig.h --- gc-7.2.orig/include/private/gcconfig.h 2012-08-09 15:25:13.000000000 -0500 +++ gc-7.2/include/private/gcconfig.h 2012-10-13 16:30:15.411245000 -0500 @@ -2549,6 +2549,9 @@ #if defined(GC_NETBSD_THREADS) && !defined(NETBSD) # error --> inconsistent configuration #endif +#if defined(GC_DRAGONFLY_THREADS) && !defined(__DragonFly__) +# error --> inconsistent configuration +#endif #if defined(GC_FREEBSD_THREADS) && !defined(FREEBSD) # error --> inconsistent configuration #endif diff -urw gc-7.2.orig/include/private/thread_local_alloc.h gc-7.2/include/private/thread_local_alloc.h --- gc-7.2.orig/include/private/thread_local_alloc.h 2012-08-09 15:25:13.000000000 -0500 +++ gc-7.2/include/private/thread_local_alloc.h 2012-10-13 16:29:39.672517000 -0500 @@ -47,7 +47,8 @@ # 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_RTEMS_PTHREADS) + || defined(GC_NETBSD_THREADS) || defined(GC_DRAGONFLY_THREADS) \ + || defined(GC_RTEMS_PTHREADS) # define USE_PTHREAD_SPECIFIC # elif defined(GC_HPUX_THREADS) # ifdef __GNUC__ diff -urw gc-7.2.orig/pthread_stop_world.c gc-7.2/pthread_stop_world.c --- gc-7.2.orig/pthread_stop_world.c 2012-08-09 15:25:13.000000000 -0500 +++ gc-7.2/pthread_stop_world.c 2012-10-13 16:23:51.004956000 -0500 @@ -130,7 +130,7 @@ #ifndef SIG_THR_RESTART # if defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) \ - || defined(GC_NETBSD_THREADS) + || defined(GC_NETBSD_THREADS) || defined(GC_DRAGONFLY_THREADS) # ifdef _SIGRTMIN # define SIG_THR_RESTART _SIGRTMIN + 5 # else diff -urw gc-7.2.orig/pthread_support.c gc-7.2/pthread_support.c --- gc-7.2.orig/pthread_support.c 2012-08-09 15:25:13.000000000 -0500 +++ gc-7.2/pthread_support.c 2012-10-13 16:22:07.768255000 -0500 @@ -73,7 +73,8 @@ # include #endif /* GC_DARWIN_THREADS */ -#if defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) +#if defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) \ + || defined(GC_DRAGONFLY_THREADS) # include # include #endif /* GC_NETBSD_THREADS */ @@ -917,7 +918,8 @@ #endif /* GC_DGUX386_THREADS */ #if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS) \ - || defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) + || defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) \ + || defined(GC_DRAGONFLY_THREADS) static int get_ncpu(void) { int mib[] = {CTL_HW,HW_NCPU}; @@ -1006,7 +1008,8 @@ GC_nprocs = sysconf(_SC_NPROC_ONLN); if (GC_nprocs <= 0) GC_nprocs = 1; # elif defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS) \ - || defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) + || defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) \ + || defined(GC_DRAGONFLY_THREADS) GC_nprocs = get_ncpu(); # elif defined(GC_LINUX_THREADS) || defined(GC_DGUX386_THREADS) GC_nprocs = GC_get_nprocs();