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

Bug#524671: gcj-4.3: Fix gcj build on hurd-i386



Package: gcj-4.3
Version: 4.3.3-3
Severity: important
Tags: patch

Hello,

The attached patch applies upstream fixes that make gcj buildable on
hurd-i386:

- set thread_file to posix in config.gcc (as in gcc upstream)
- fix GNU/Hurd thread bits in boehm-gc (as in boehm-gc upstream)

The same patch can be applied to gcj-4.2, if you consider uploading
another it. For gcj-4.4, the patch will be different and maybe we'll
already have it applied upstream actually, so let's not handle that one
immediately.

Samuel

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.29 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gcj-4.3 depends on:
ii  gcc-4.3                4.3.3-3           The GNU C compiler
ii  gcj-4.3-base           4.3.3-3           The GNU Compiler Collection (gcj b
ii  gij-4.3                4.3.3-3           The GNU Java bytecode interpreter
ii  java-common            0.31              Base of all Java packages
ii  libc6                  2.9-4             GNU C Library: Shared libraries
ii  libc6-dev              2.9-4             GNU C Library: Development Librari
ii  libecj-java            3.4.2-1           Eclipse Java compiler (library)
ii  libgcc1                1:4.4-20090329-1  GCC support library
ii  libgcj-bc              4.3.3-2           Link time only library for use wit
ii  libgcj9-0              4.3.3-3           Java runtime library for use with 
ii  libgcj9-dev            4.3.3-3           Java development headers for use w
ii  libgcj9-jar            4.3.3-3           Java runtime library for use with 
ii  libgmp3c2              2:4.2.4+dfsg-2    Multiprecision arithmetic library
ii  libmpfr1ldbl           2.4.1-1           multiple precision floating-point 
ii  zlib1g                 1:1.2.3.3.dfsg-13 compression library - runtime

Versions of packages gcj-4.3 recommends:
ii  ecj-gcj [libecj-java-gcj]     3.4.2-1    standalone version of the Eclipse 
ii  fastjar                       2:0.97-3   Jar creation utility
ii  libecj-java-gcj               3.4.2-1    Eclipse Java compiler (native libr

Versions of packages gcj-4.3 suggests:
ii  java-gcj-compat-dev           1.0.80-1   Java runtime environment with GCJ
pn  libgcj9-dbg                   <none>     (no description available)

-- no debconf information

-- 
Samuel
<m> argh, pi est plus grand que 2. Ca casse tout
 -+- #ens-mim -+-
--- debian/rules.patch.orig	2009-02-08 04:11:55.559079000 +0000
+++ debian/rules.patch	2009-02-07 14:17:13.000000000 +0000
@@ -166,7 +166,7 @@
 endif
 
 ifeq ($(DEB_TARGET_ARCH_OS),hurd)
-  debian_patches += hurd-changes
+  debian_patches += hurd-changes hurd-pthread
 endif
 
 ifeq ($(DEB_TARGET_ARCH),alpha)
--- /dev/null	2007-12-29 19:47:02.000000000 +0000
+++ debian/patches/hurd-pthread.dpatch	2009-02-08 04:14:01.019273000 +0000
@@ -0,0 +1,205 @@
+#! /bin/sh -e
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        ;;
+    *)
+        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+        exit 1
+esac
+exit 0
+
+# Fix pthread support in boehm-gc
+
+--- gcc/config.gcc.orig	2009-02-07 14:05:00.000000000 +0000
++++ gcc/config.gcc	2009-02-07 14:05:10.478631000 +0000
+@@ -490,6 +490,9 @@
+   # GNU tools are the only tools.
+   gas=yes
+   gnu_ld=yes
++  case ${enable_threads} in
++    "" | yes | posix) thread_file='posix' ;;
++  esac
+   # These details are the same as for Linux.
+   # But here we need a little extra magic.
+   tmake_file="t-slibgcc-elf-ver t-linux t-gnu"
+--- boehm-gc/pthread_support.c.orig	2009-02-07 22:27:11.828527000 +0000
++++ boehm-gc/pthread_support.c	2009-02-07 22:27:18.279505000 +0000
+@@ -885,7 +885,7 @@
+ 	  GC_nprocs = pthread_num_processors_np();
+ #       endif
+ #	if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) \
+-	   || defined(GC_SOLARIS_PTHREADS)
++	   || defined(GC_SOLARIS_PTHREADS) || defined(GC_GNU_THREADS)
+ 	  GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN);
+ 	  if (GC_nprocs <= 0) GC_nprocs = 1;
+ #	endif
+--- boehm-gc/include/gc_config_macros.h.orig	2009-02-07 22:25:08.240177000 +0000
++++ boehm-gc/include/gc_config_macros.h	2009-02-07 22:28:40.648347000 +0000
+@@ -6,7 +6,8 @@
+ 		             || defined(GC_SOLARIS_PTHREADS) \
+ 			     || defined(GC_HPUX_THREADS) \
+ 			     || defined(GC_AIX_THREADS) \
+-			     || defined(GC_LINUX_THREADS))
++			     || defined(GC_LINUX_THREADS) \
++			     || defined(GC_GNU_THREADS))
+ # define _REENTRANT
+ 	/* Better late than never.  This fails if system headers that	*/
+ 	/* depend on this were previously included.			*/
+@@ -21,7 +22,8 @@
+ 	defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) || \
+ 	defined(GC_DGUX386_THREADS) || defined(GC_DARWIN_THREADS) || \
+ 	defined(GC_AIX_THREADS) || \
+-        (defined(GC_WIN32_THREADS) && defined(__CYGWIN32__))
++        (defined(GC_WIN32_THREADS) && defined(__CYGWIN32__)) || \
++	defined(GC_GNU_THREADS)
+ #   define GC_PTHREADS
+ # endif
+ 
+--- boehm-gc/threadlibs.c.orig	2009-02-07 22:34:42.429201000 +0000
++++ boehm-gc/threadlibs.c	2009-02-07 22:34:49.530544000 +0000
+@@ -12,7 +12,8 @@
+ #   endif
+ #   if defined(GC_LINUX_THREADS) || defined(GC_IRIX_THREADS) \
+ 	|| defined(GC_SOLARIS_PTHREADS) \
+-	|| defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS)
++	|| defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) \
++	|| defined(GC_GNU_THREADS)
+         printf("-lpthread\n");
+ #   endif
+ #   if defined(GC_FREEBSD_THREADS)
+--- boehm-gc/configure.ac.orig	2009-02-07 22:30:12.000000000 +0000
++++ boehm-gc/configure.ac	2009-02-07 22:35:31.717091000 +0000
+@@ -172,6 +172,11 @@
+ 	AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
+ 	THREADLIBS=-pthread
+       	;;
++     *-*-gnu*)
++	AC_DEFINE(GC_GNU_THREADS,1,[support GNU threads])
++	AC_DEFINE(_REENTRANT)
++	AC_DEFINE(THREAD_LOCAL_ALLOC)
++      	;;
+      *-*-solaris*)
+ 	AC_DEFINE(GC_SOLARIS_PTHREADS,1,[support for Solaris pthreads])
+ 	# Need to use alternate thread library, otherwise gctest hangs
+--- boehm-gc/configure.orig	2009-02-07 22:32:34.000000000 +0000
++++ boehm-gc/configure	2009-02-07 22:35:28.065650000 +0000
+@@ -5489,6 +5489,20 @@
+ 	AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
+ 	THREADLIBS=-pthread
+       	;;
++     *-*-gnu*)
++cat >>confdefs.h <<\_ACEOF
++#define GC_GNU_THREADS 1
++_ACEOF
++
++       cat >>confdefs.h <<\_ACEOF
++#define _REENTRANT 1
++_ACEOF
++
++cat >>confdefs.h <<\_ACEOF
++#define THREAD_LOCAL_ALLOC 1
++_ACEOF
++
++      	;;
+      *-*-solaris*)
+ 
+ cat >>confdefs.h <<\_ACEOF
+--- boehm-gc/os_dep.c.orig	2009-02-07 22:37:20.000000000 +0000
++++ boehm-gc/os_dep.c	2009-02-07 22:37:40.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);
+--- boehm-gc/include/private/gcconfig.h.orig	2009-02-07 22:29:18.000000000 +0000
++++ boehm-gc/include/private/gcconfig.h	2009-02-07 22:41:24.598684000 +0000
+@@ -1316,8 +1316,9 @@
+ #     define OS_TYPE "HURD"
+ #     define STACK_GROWS_DOWN
+ #     define HEURISTIC2
+-      extern int  __data_start[];
+-#     define DATASTART ( (ptr_t) (__data_start))
++#     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? */
+@@ -2153,7 +2154,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
+ 
+@@ -2209,7 +2211,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	*/
+@@ -2244,6 +2246,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
+--- boehm-gc/include/gc_config.h.in.orig	2009-02-08 01:51:09.707191000 +0000
++++ boehm-gc/include/gc_config.h.in	2009-02-08 01:54:06.298757000 +0000
+@@ -33,6 +33,9 @@
+ /* include support for gcj */
+ #undef GC_GCJ_SUPPORT
+ 
++/* support GNU/Hurd threads */
++#undef GC_GNU_THREADS
++
+ /* enables support for HP/UX 11 pthreads */
+ #undef GC_HPUX_THREADS
+ 
+--- boehm-gc/specific.c.orig	2009-02-08 03:44:40.833287000 +0000
++++ boehm-gc/specific.c	2009-02-08 03:44:50.865199000 +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"
+ 

Reply to: