2006-11-16 Hans Boehm <Hans.Boehm@hp.com> (really from Aleksey Demakov,
authorhboehm <hboehm>
Fri, 17 Nov 2006 05:28:22 +0000 (05:28 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:38 +0000 (21:06 +0400)
Barry DeFreese and possibly other Debian maintainers)
*  configure.ac dyn_load.c os_dep.c pthread_support.c,
threadlibs.c include/gc_config_macros.h, include/private/gcconfig.h:
Add GC_GNU_THREADS/HURD support.

configure.ac
dyn_load.c
include/gc_config_macros.h
include/private/gcconfig.h
os_dep.c
pthread_support.c
threadlibs.c

index a3c058c..26fe812 100644 (file)
@@ -22,7 +22,7 @@ AC_INIT(gc,7.0alpha8,Hans.Boehm@hp.com)
 AC_CONFIG_SRCDIR(gcj_mlc.c)
 AC_CANONICAL_TARGET 
 AC_PREREQ(2.53)
-AC_REVISION($Revision: 1.16 $)
+AC_REVISION($Revision: 1.17 $)
 GC_SET_VERSION
 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects nostdinc])
 AM_MAINTAINER_MODE
@@ -93,6 +93,11 @@ case "$THREADS" in
        AC_DEFINE(GC_LINUX_THREADS)
        AC_DEFINE(_REENTRANT)
        ;;
+     *-*-gnu*)
+       AC_DEFINE(GC_GNU_THREADS)
+       AC_DEFINE(_REENTRANT)
+       AC_DEFINE(THREAD_LOCAL_ALLOC)
+       ;;
      *-*-aix*)
        AC_DEFINE(GC_AIX_THREADS)
        AC_DEFINE(_REENTRANT)
index f69e7e8..8540e49 100644 (file)
@@ -26,7 +26,8 @@
  * 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(__GLIBC__)) && !defined(_GNU_SOURCE)
+#if (defined(__linux__) || defined(__GLIBC__) || defined(__GNU__)) \
+     && !defined(_GNU_SOURCE)
     /* Can't test LINUX, since this must be define before other includes */
 #   define _GNU_SOURCE
 #endif
index 4f558ff..a46deb0 100644 (file)
@@ -44,7 +44,8 @@
                             || defined(GC_HPUX_THREADS) \
                             || defined(GC_AIX_THREADS) \
                             || defined(GC_LINUX_THREADS) \
-                            || defined(GC_NETBSD_THREADS))
+                            || defined(GC_NETBSD_THREADS) \
+                            || defined(GC_GNU_THREADS))
 # define _REENTRANT
        /* Better late than never.  This fails if system headers that   */
        /* depend on this were previously included.                     */
@@ -63,7 +64,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_GNU_THREADS)
 #   define GC_PTHREADS
 # endif
 
index 767a423..ea5685e 100644 (file)
 #     define OS_TYPE "HURD"
 #     define STACK_GROWS_DOWN
 #     define HEURISTIC2
-      extern int  __data_start[];
-#     define DATASTART ( (ptr_t) (__data_start))
-      extern int   _end[];
-#     define DATAEND ( (ptr_t) (_end))
+#     define SIG_SUSPEND SIGUSR1
+#     define SIG_THR_RESTART SIGUSR2
+#     define SEARCH_FOR_DATA_START
+      extern int _end[];
+#     define DATAEND ((ptr_t) (_end))
 /* #     define MPROTECT_VDB  Not quite working yet? */
 #     define DYNAMIC_LOADING
 #   endif
 # if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
            || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
            || defined(DGUX) || defined(BSD) \
-           || defined(AIX) || defined(DARWIN) || defined(OSF1)
+           || defined(AIX) || defined(DARWIN) || defined(OSF1) \
+           || defined(HURD)
 #   define UNIX_LIKE   /* Basic Unix-like system calls work.   */
 # endif
 
 #   define CACHE_LINE_SIZE 32  /* Wild guess   */
 # endif
 
-# if defined(LINUX) || defined(__GLIBC__)
+# if defined(LINUX) || defined(HURD) || 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 */
 # if defined(GC_AIX_THREADS) && !defined(_AIX)
        --> inconsistent configuration
 # endif
+# if defined(GC_GNU_THREADS) && !defined(HURD)
+       --> inconsistent configuration
+# endif
 # if defined(GC_WIN32_THREADS) && !defined(MSWIN32) && !defined(CYGWIN32)
        --> inconsistent configuration
 # endif
index 975816f..5d0294b 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -422,7 +422,7 @@ static ptr_t backing_store_base_from_proc(void)
   /* for recent Linux versions.  This seems to be the easiest way to   */
   /* cover all versions.                                               */
 
-# ifdef LINUX
+# if defined(LINUX) || defined(HURD)
     /* Some Linux distributions arrange to define __data_start.  Some  */
     /* define data_start as a weak symbol.  The latter is technically  */
     /* broken, since the user program may define data_start, in which  */
@@ -441,7 +441,7 @@ static ptr_t backing_store_base_from_proc(void)
   {
     extern ptr_t GC_find_limit(ptr_t, GC_bool);
 
-#   ifdef LINUX
+#   if defined(LINUX) || defined(HURD)
       /* Try the easy approaches first:        */
       if ((ptr_t)__data_start != 0) {
          GC_data_start = (ptr_t)(__data_start);
index 6eec221..ff0f5e8 100644 (file)
@@ -785,6 +785,9 @@ void GC_thr_init(void)
 #      if defined(GC_LINUX_THREADS) || defined(GC_DGUX386_THREADS)
           GC_nprocs = GC_get_nprocs();
 #      endif
+#       if defined(GC_GNU_THREADS)
+         if (GC_nprocs <= 0) GC_nprocs = 1;
+#       endif
       }
       if (GC_nprocs <= 0) {
        WARN("GC_get_nprocs() returned %ld\n", GC_nprocs);
index ff52bda..50e962d 100644 (file)
@@ -11,7 +11,8 @@ int main()
               "-Wl,--wrap -Wl,pthread_sigmask -Wl,--wrap -Wl,sleep\n");
 #   endif
 #   if defined(GC_LINUX_THREADS) || defined(GC_IRIX_THREADS) \
-       || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS)
+       || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) \
+       || defined(GC_GNU_THREADS)
 #       ifdef GC_USE_DLOPEN_WRAP
          printf("-ldl ");
 #      endif