summaryrefslogtreecommitdiff
path: root/libgc
diff options
context:
space:
mode:
authorJo Shields <directhex@apebox.org>2014-02-19 22:56:41 +0000
committerJo Shields <directhex@apebox.org>2014-02-19 22:56:41 +0000
commitf9f077cbdc52123a3828bbb475bd7111c8d6c150 (patch)
tree66c059d911f465e3b275f8955a475a922403fd80 /libgc
parentb369b84d1bdb59abb34e3ac93c24f7f252d4c84b (diff)
parentb5c7654dd78182fdb806f0558b71aa37c8d05cd4 (diff)
downloadmono-f9f077cbdc52123a3828bbb475bd7111c8d6c150.tar.gz
Merge branch 'master-experimental-patches/kfreebsd_support' into merge/3.2.8+dfsg
Diffstat (limited to 'libgc')
-rw-r--r--libgc/configure.in11
-rw-r--r--libgc/dyn_load.c4
-rw-r--r--libgc/include/gc.h2
-rw-r--r--libgc/include/private/gcconfig.h41
4 files changed, 49 insertions, 9 deletions
diff --git a/libgc/configure.in b/libgc/configure.in
index 837e2cb9f1..39e3d30a24 100644
--- a/libgc/configure.in
+++ b/libgc/configure.in
@@ -114,6 +114,17 @@ case "$THREADS" in
AC_DEFINE(THREAD_LOCAL_ALLOC)
THREADDLLIBS="-lpthread -lrt"
;;
+ *-*-kfreebsd*-gnu)
+ AC_DEFINE(GC_FREEBSD_THREADS)
+ INCLUDES="$INCLUDES -pthread"
+ THREADDLLIBS=-pthread
+ AC_DEFINE(_REENTRANT)
+ if test "${enable_parallel_mark}" = yes; then
+ AC_DEFINE(PARALLEL_MARK)
+ fi
+ AC_DEFINE(THREAD_LOCAL_ALLOC)
+ AC_DEFINE(USE_COMPILER_TLS)
+ ;;
*-*-freebsd*)
AC_DEFINE(GC_FREEBSD_THREADS)
if test "x$PTHREAD_CFLAGS" != "x"; then
diff --git a/libgc/dyn_load.c b/libgc/dyn_load.c
index ca7ce54f19..5db3503aac 100644
--- a/libgc/dyn_load.c
+++ b/libgc/dyn_load.c
@@ -26,7 +26,7 @@
* None of this is safe with dlclose and incremental collection.
* But then not much of anything is safe in the presence of dlclose.
*/
-#if (defined(__linux__) || defined(__native_client__)) && !defined(_GNU_SOURCE)
+#if (defined(__linux__) || defined(__GLIBC__) || defined(__native_client__)) && !defined(_GNU_SOURCE)
/* Can't test LINUX, since this must be define before other includes */
# define _GNU_SOURCE
#endif
@@ -394,7 +394,7 @@ 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 (__GLIBC__) || defined(NACL)) /* Are others OK here, too? */ \
&& (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
diff --git a/libgc/include/gc.h b/libgc/include/gc.h
index 123d6cce08..84a4f6e3f2 100644
--- a/libgc/include/gc.h
+++ b/libgc/include/gc.h
@@ -493,7 +493,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
# define GC_RETURN_ADDR (GC_word)__return_address
#endif
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
# include <features.h>
# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
&& !defined(__ia64__)
diff --git a/libgc/include/private/gcconfig.h b/libgc/include/private/gcconfig.h
index 418e046ae1..a45dcba613 100644
--- a/libgc/include/private/gcconfig.h
+++ b/libgc/include/private/gcconfig.h
@@ -55,7 +55,7 @@
# endif
/* And one for FreeBSD: */
-# if defined(__FreeBSD__) && !defined(FREEBSD)
+# if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(FREEBSD)
# define FREEBSD
# endif
@@ -1371,8 +1371,15 @@
# ifndef GC_FREEBSD_THREADS
# define MPROTECT_VDB
# endif
-# define SIG_SUSPEND SIGTSTP
-# define SIG_THR_RESTART SIGCONT
+# ifdef __GLIBC__
+# define SIG_SUSPEND (32+6)
+# define SIG_THR_RESTART (32+5)
+ extern int _end[];
+# define DATAEND (_end)
+# else
+# define SIG_SUSPEND SIGTSTP
+# define SIG_THR_RESTART SIGCONT
+# endif
# define FREEBSD_STACKBOTTOM
# ifdef __ELF__
# define DYNAMIC_LOADING
@@ -2143,6 +2150,28 @@
extern char * GC_FreeBSDGetDataStart();
# define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
# endif
+# ifdef FREEBSD
+# define OS_TYPE "FREEBSD"
+# ifndef GC_FREEBSD_THREADS
+# define MPROTECT_VDB
+# endif
+# ifdef __GLIBC__
+# define SIG_SUSPEND (32+6)
+# define SIG_THR_RESTART (32+5)
+ extern int _end[];
+# define DATAEND (_end)
+# else
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
+# endif
+# define FREEBSD_STACKBOTTOM
+# ifdef __ELF__
+# define DYNAMIC_LOADING
+# endif
+ extern char etext[];
+ extern char * GC_FreeBSDGetDataStart();
+# define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
+# endif
# ifdef NETBSD
# define OS_TYPE "NETBSD"
# ifdef __ELF__
@@ -2230,7 +2259,7 @@
# define SUNOS5SIGS
# endif
-# if defined(FREEBSD) && (__FreeBSD__ >= 4)
+# if defined(FREEBSD) && ((__FreeBSD__ >= 4) || (__FreeBSD_kernel__ >= 4))
# define SUNOS5SIGS
# endif
@@ -2293,7 +2322,7 @@
# define CACHE_LINE_SIZE 32 /* Wild guess */
# endif
-# ifdef LINUX
+# if defined(LINUX) || defined(__GLIBC__)
# define REGISTER_LIBRARIES_EARLY
/* We sometimes use dl_iterate_phdr, which may acquire an internal */
/* lock. This isn't safe after the world has stopped. So we must */
@@ -2374,7 +2403,7 @@
#if defined(SPARC)
# define CAN_SAVE_CALL_ARGS
#endif
-#if (defined(I386) || defined(X86_64)) && defined(LINUX)
+#if (defined(I386) || defined(X86_64)) && (defined(LINUX) || defined(__GLIBC__))
/* SAVE_CALL_CHAIN is supported if the code is compiled to save */
/* frame pointers by default, i.e. no -fomit-frame-pointer flag. */
# define CAN_SAVE_CALL_ARGS