[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libgc: [patch] Thread support for GNU/Hurd



Hi,

Barry deFreese, le Sun 30 Dec 2007 12:36:41 -0500, a écrit :
> Here is an updated patch that should apply fine and has moved the gnu 
> triplet below the kfreebsd check.  As with Michael's original diff, you 
> will need to reconfigure as I have not included those in the diff.

There was some misplaced parenthesis, here is a fixed patch.

Samuel
diff -urN libgc-6.8.org/configure.in libgc-6.8/configure.in
--- libgc-6.8.org/configure.in	2007-12-30 12:38:32.000000000 +0000
+++ libgc-6.8/configure.in	2007-12-29 22:30:20.620000000 +0000
@@ -122,6 +122,11 @@
 	AC_DEFINE(THREAD_LOCAL_ALLOC)
 	AC_DEFINE(USE_COMPILER_TLS)
       	;;
+     *-*-gnu*)
+	AC_DEFINE(GC_GNU_THREADS)
+	AC_DEFINE(_REENTRANT)
+	AC_DEFINE(THREAD_LOCAL_ALLOC)
+	;;
      *-*-netbsd*)
 	AC_MSG_WARN("Only on NetBSD 2.0 or later.")
 	AC_DEFINE(GC_NETBSD_THREADS)
diff -urN libgc-6.8.org/debian/rules libgc-6.8/debian/rules
--- libgc-6.8.org/debian/rules	2007-12-30 12:38:32.000000000 +0000
+++ libgc-6.8/debian/rules	2007-12-29 22:22:16.000000000 +0000
@@ -4,12 +4,6 @@
 
 DEB_BUILD_ARCH:=$(shell dpkg --print-installation-architecture)
 
-ifeq ($(DEB_BUILD_ARCH),hurd-i386)
-	CONFIG_OPTS:=--disable-threads
-else
-	CONFIG_OPTS:=
-endif
-
 export DH_COMPAT=4
 
 # Uncomment this to turn on verbose mode. 
@@ -20,7 +14,7 @@
 	dh_testdir
 	
 	# First build the shared library
-	./configure $(CONFIG_OPTS) --enable-cplusplus --disable-dependency-tracking \
+	./configure --enable-cplusplus --disable-dependency-tracking \
 		--with-tags=CXX --prefix=/usr --mandir=\$${prefix}/share/man\
 		--sysconfdir=/etc --localstatedir=/var/lib\
 		--datadir=\$${prefix}/share/doc
diff -urN libgc-6.8.org/dyn_load.c libgc-6.8/dyn_load.c
--- libgc-6.8.org/dyn_load.c	2006-06-07 05:01:52.000000000 +0000
+++ libgc-6.8/dyn_load.c	2007-12-29 22:24:31.140000000 +0000
@@ -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
diff -urN libgc-6.8.org/include/gc_config_macros.h libgc-6.8/include/gc_config_macros.h
--- libgc-6.8.org/include/gc_config_macros.h	2006-03-10 22:15:43.000000000 +0000
+++ libgc-6.8/include/gc_config_macros.h	2007-12-29 22:48:21.780000000 +0000
@@ -43,7 +43,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.			*/
@@ -62,7 +63,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
 
diff -urN libgc-6.8.org/include/private/gcconfig.h libgc-6.8/include/private/gcconfig.h
--- libgc-6.8.org/include/private/gcconfig.h	2007-12-30 12:38:32.000000000 +0000
+++ libgc-6.8/include/private/gcconfig.h	2007-12-29 22:21:16.006350696 +0000
@@ -1316,10 +1316,11 @@
 #     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
@@ -2154,7 +2155,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(HURD)
 #   define UNIX_LIKE   /* Basic Unix-like system calls work.	*/
 # endif
 
@@ -2210,7 +2212,7 @@
 #   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	*/
@@ -2253,6 +2255,9 @@
 # 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
diff -urN libgc-6.8.org/os_dep.c libgc-6.8/os_dep.c
--- libgc-6.8.org/os_dep.c	2006-04-21 23:26:47.000000000 +0000
+++ libgc-6.8/os_dep.c	2007-12-29 22:24:01.000000000 +0000
@@ -312,7 +312,7 @@
   /* 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	*/
@@ -331,7 +331,7 @@
   {
     extern ptr_t GC_find_limit();
 
-#   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);
diff -urN libgc-6.8.org/pthread_support.c libgc-6.8/pthread_support.c
--- libgc-6.8.org/pthread_support.c	2006-06-28 22:38:42.000000000 +0000
+++ libgc-6.8/pthread_support.c	2007-12-29 22:25:43.000000000 +0000
@@ -919,6 +919,9 @@
 #	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);
diff -urN libgc-6.8.org/specific.c libgc-6.8/specific.c
--- libgc-6.8.org/specific.c	2004-08-16 22:53:02.000000000 +0000
+++ libgc-6.8/specific.c	2007-12-29 22:26:07.630000000 +0000
@@ -13,7 +13,7 @@
 
 #include "private/gc_priv.h" /* For GC_compare_and_exchange, GC_memory_barrier */
 
-#if defined(GC_LINUX_THREADS)
+#if defined(GC_LINUX_THREADS) || defined(GC_GNU_THREADS)
 
 #include "private/specific.h"
 
diff -urN libgc-6.8.org/threadlibs.c libgc-6.8/threadlibs.c
--- libgc-6.8.org/threadlibs.c	2006-02-17 04:07:15.520000000 +0000
+++ libgc-6.8/threadlibs.c	2007-12-29 22:28:34.000000000 +0000
@@ -11,7 +11,7 @@
 	       "-Wl,--wrap -Wl,pthread_sigmask -Wl,--wrap -Wl,sleep\n");
 #   endif
 #   if defined(GC_LINUX_THREADS) || defined(GC_IRIX_THREADS) \
-	|| defined(GC_SOLARIS_PTHREADS) \
+	|| defined(GC_SOLARIS_PTHREADS) || defined(GC_GNU_THREADS) \
 	|| defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS)
         printf("-lpthread\n");
 #   endif

Reply to: