Bug#401724: libgc: [patch] Thread support for GNU/Hurd

2007-12-30 Thread Barry deFreese

tags 401724 + patch

thank you


Hi,

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.


Thank you,

Barry deFreese


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.0 +
+++ libgc-6.8/configure.in  2007-12-29 22:30:20.62000 +
@@ -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.0 +
+++ libgc-6.8/debian/rules  2007-12-29 22:22:16.0 +
@@ -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.c2006-06-07 05:01:52.0 +
+++ libgc-6.8/dyn_load.c2007-12-29 22:24:31.14000 +
@@ -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.h2006-03-10 22:15:43.0 
+
+++ libgc-6.8/include/gc_config_macros.h2007-12-29 22:48:21.78000 
+
@@ -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.h2007-12-30 12:38:32.0 
+
+++ libgc-6.8/include/private/gcconfig.h2007-12-29 22:21:16.006350696 
+
@@ -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) 

Bug#401724: libgc: [patch] Thread support for GNU/Hurd

2007-12-30 Thread Samuel Thibault
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.0 +
+++ libgc-6.8/configure.in	2007-12-29 22:30:20.62000 +
@@ -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.0 +
+++ libgc-6.8/debian/rules	2007-12-29 22:22:16.0 +
@@ -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.0 +
+++ libgc-6.8/dyn_load.c	2007-12-29 22:24:31.14000 +
@@ -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.0 +
+++ libgc-6.8/include/gc_config_macros.h	2007-12-29 22:48:21.78000 +
@@ -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.0 +
+++ libgc-6.8/include/private/gcconfig.h	2007-12-29 22:21:16.006350696 +
@@ -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 

Bug#401724: libgc: [patch] Thread support for GNU/Hurd

2007-01-12 Thread Petr Salinger

Please, do not use the patch as is.
It would break GNU/kFreeBSD support.

The *-*-gnu*) case must be after
*-*-kfreebsd*-gnu) in configure.in.

Thanks
Petr



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#401724: libgc: [patch] Thread support for GNU/Hurd

2006-12-05 Thread Michael Banck
Package: libgc
Version: 1:6.8-1

Hi,

Aleksey Demakov has implemented thread support for GNU/Hurd, Hans Boehm
has committed a slightly different version accounting for the changes
from 6.8 to his 7.0 branch.

Aleksey's patch (plus the debian/rules hunk to remove the
--without-threads again) is attached, I ommitted the configure changes
from my interdiff.


thanks,

Michael
diff -u libgc-6.8/include/private/gcconfig.h 
libgc-6.8/include/private/gcconfig.h
--- libgc-6.8/include/private/gcconfig.h
+++ libgc-6.8/include/private/gcconfig.h
@@ -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 -u libgc-6.8/debian/rules libgc-6.8/debian/rules
--- libgc-6.8/debian/rules
+++ libgc-6.8/debian/rules
@@ -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
only in patch2:
unchanged:
--- libgc-6.8.orig/os_dep.c
+++ libgc-6.8/os_dep.c
@@ -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);
only in patch2:
unchanged:
--- libgc-6.8.orig/dyn_load.c
+++ libgc-6.8/dyn_load.c
@@ -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
only in patch2:
unchanged:
--- libgc-6.8.orig/pthread_support.c
+++ libgc-6.8/pthread_support.c
@@ -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);
only in patch2:
unchanged:
--- libgc-6.8.orig/specific.c
+++ libgc-6.8/specific.c
@@ -13,7 +13,7 @@
 
 #include private/gc_priv.h /* For GC_compare_and_exchange, GC_memory_barrier 
*/
 
-#if