[Gc] NetBSD-patches for boehm-gc

Hubert Feyrer hubert.feyrer at informatik.fh-regensburg.de
Wed Mar 31 07:59:04 PST 2004


Hi!

below you will find some patches against boehm-gc-6.2 that are
currently part of the NetBSD Packages Collection, pkgsrc, to get your
software build properly on NetBSD and maybe some other platforms. We'd
be pleased if you could include as much of these patches into your next
release as possible, thanks!

FWIW, your software has a webpage at the NetBSD site, see

	http://www.NetBSD.org/packages/devel/boehm-gc/README.html

See http://www.NetBSD.org/Documentation/software/packages.html
to learn more about the NetBSD Packages Collection, to find out
more about the NetBSD operating system, see http://www.NetBSD.org/.


 - Hubert



--- 8X --- 8X --- 8X --- 8X --- 8X --- 8X --- 8X --- 8X --- 8X --- 8X ---

$NetBSD: patch-aa,v 1.14 2003/05/22 16:46:50 jmmv Exp $

--- Makefile.direct.orig	2003-03-07 20:08:44.000000000 +0100
+++ Makefile.direct	2003-05-14 00:27:50.000000000 +0200
@@ -20,8 +20,8 @@
 # executables.

 CC=cc $(ABI_FLAG)
-CXX=g++ $(ABI_FLAG)
-AS=as $(AS_ABI_FLAG)
+CXX=c++ $(ABI_FLAG)
+AS=gcc -c -x assembler-with-cpp $(ABI_FLAG)
 #  The above doesn't work with gas, which doesn't run cpp.
 #  Define AS as `gcc -c -x assembler-with-cpp' instead.

@@ -359,16 +359,23 @@

 all: gc.a gctest

-BSD-pkg-all: bsd-libgc.a
+LEAKFLAGS=$(CFLAGS) -DFIND_LEAK
+
+BSD-pkg-all: bsd-libgc.a bsd-libleak.a

 bsd-libgc.a:
 	$(MAKE) CFLAGS="$(CFLAGS)" clean c++-t
 	mv gc.a bsd-libgc.a

+bsd-libleak.a:
+	$(MAKE) -f Makefile.direct CFLAGS="$(LEAKFLAGS)" clean c++-nt
+	mv gc.a bsd-libleak.a
+
 BSD-pkg-install: BSD-pkg-all
 	${CP} bsd-libgc.a libgc.a
 	${INSTALL_DATA} libgc.a ${PREFIX}/lib
 	${INSTALL_DATA} gc.h gc_cpp.h ${PREFIX}/include
+	${INSTALL_MAN} doc/gc.man ${PREFIX}/man/man3/gc.3

 pcr: PCR-Makefile include/private/gc_private.h include/private/gc_hdrs.h \
 include/private/gc_locks.h include/gc.h include/private/gcconfig.h \
@@ -444,7 +451,6 @@
 	./if_mach M68K AMIGA $(AR) -vrus gc.a gc_cpp.o
 	./if_not_there dont_ar_4 $(AR) ru gc.a gc_cpp.o
 	./if_not_there dont_ar_4 $(RANLIB) gc.a || cat /dev/null
-	./test_cpp 1
 	echo > c++

 dyn_load_sunos53.o: dyn_load.c
$NetBSD: patch-ab,v 1.10 2003/05/22 16:46:50 jmmv Exp $

--- dyn_load.c.orig	2003-05-09 03:45:10.000000000 +0200
+++ dyn_load.c	2003-05-14 00:28:16.000000000 +0200
@@ -446,6 +446,16 @@

 #if defined(NETBSD)
 #  include <sys/exec_elf.h>
+/* for compatibility with 1.4.x */
+#  ifndef DT_DEBUG
+#  define DT_DEBUG     21
+#  endif
+#  ifndef PT_LOAD
+#  define PT_LOAD      1
+#  endif
+#  ifndef PF_W
+#  define PF_W         2
+#  endif
 #else
 #  include <elf.h>
 #endif
$NetBSD: patch-ac,v 1.10 2001/09/08 00:36:10 kei Exp $

--- doc/gc.man.in.orig	Tue Sep 21 16:55:00 1999
+++ doc/gc.man.in
@@ -9,7 +9,9 @@
 ... malloc(...) ...
 .br
 .sp
-cc ... gc.a
+cc ... -lgc
+.sp
+cc ... -lleak
 .LP
 .SH DESCRIPTION
 .I GC_malloc
@@ -67,6 +69,48 @@
 This may temporarily write protect pages in the heap.  See the README file for more information on how this interacts with system calls that write to the heap.
 .LP
 Other facilities not discussed here include limited facilities to support incremental collection on machines without appropriate VM support, provisions for providing more explicit object layout information to the garbage collector, more direct support for ``weak'' pointers, support for ``abortable'' garbage collections during idle time, etc.
+.LP
+.SH "PORT INFORMATION"
+.LP
+In this (BSD package) installation,
+.I gc.h
+and
+.I gc_cpp.h
+will be found in
+.I @PREFIX@/include,
+and the libraries in
+.I @PREFIX@/lib.
+.LP
+These libraries have been compiled as drop-in replacements
+for malloc and free (which is to say, all malloc
+calls will allocate garbage-collectable data).
+There is no need to include "gc.h" in your C files unless you want
+access to the debugging (and other) functions defined there,
+or unless you want to explicitly use
+.I GC_malloc_uncollectable
+for some allocations.
+Just link against them whenever you want either garbage
+collection or leak detection.
+.LP
+The C++ header file, "gc_cpp.h",
+.I is
+necessary for C++ programs, to obtain the appropriate
+definitions of the
+.I new
+and
+.I delete
+operators.
+The comments in both of these header files presently
+provide far better documentation
+for the package than this man page;
+look there for more information.
+.LP
+Both libraries are compiled without (explicit) support
+for the experimental
+.I gc
+extension of
+.I g++.
+This may or may not make a difference.
 .LP
 .SH "SEE ALSO"
 The README and gc.h files in the distribution.  More detailed definitions of the functions exported by the collector are given there.  (The above list is not complete.)
$NetBSD: patch-ad,v 1.14 2003/05/22 16:46:50 jmmv Exp $

--- include/private/gcconfig.h.orig	2003-04-30 01:44:13.000000000 +0200
+++ include/private/gcconfig.h	2003-05-14 00:28:46.000000000 +0200
@@ -83,7 +83,7 @@
 #    define SPARC
 #    define mach_type_known
 # endif
-# if defined(NETBSD) && defined(m68k)
+# if defined(NETBSD) && (defined(m68k) || defined(__m68k__))
 #    define M68K
 #    define mach_type_known
 # endif
@@ -91,7 +91,7 @@
 #    define POWERPC
 #    define mach_type_known
 # endif
-# if defined(NETBSD) && defined(__arm32__)
+# if defined(NETBSD) && (defined(__arm32__) || defined(__arm__))
 #    define ARM32
 #    define mach_type_known
 # endif
@@ -104,6 +104,10 @@
 #    endif
 #    define mach_type_known
 # endif
+# if defined(__NetBSD__) && defined(__vax__)
+#    define VAX
+#    define mach_type_known
+# endif
 # if defined(mips) || defined(__mips) || defined(_mips)
 #    define MIPS
 #    if defined(nec_ews) || defined(_nec_ews)
@@ -596,9 +600,14 @@
 #   ifdef NETBSD
 #	define OS_TYPE "NETBSD"
 #	define HEURISTIC2
+#	ifdef __ELF__
+#	  define DATASTART GC_data_start
+#	  define DYNAMIC_LOADING
+#	else
 	extern char etext[];
 #	define DATASTART ((ptr_t)(etext))
 #   endif
+#   endif
 #   ifdef LINUX
 #       define OS_TYPE "LINUX"
 #       define STACKBOTTOM ((ptr_t)0xf0000000)
$NetBSD: patch-ae,v 1.6 2003/05/09 12:53:27 jmmv Exp $

--- doc/Makefile.in.orig	2003-05-09 13:17:43.000000000 +0200
+++ doc/Makefile.in
@@ -46,7 +46,7 @@ infodir = @infodir@
 mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
-pkgdatadir = $(datadir)/@PACKAGE@
+pkgdatadir = $(datadir)/doc/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 top_builddir = ..
# $NetBSD: patch-af,v 1.7 2003/08/17 05:01:59 kei Exp $

--- Makefile.in.orig	Sun Jun 22 07:47:00 2003
+++ Makefile.in	Wed Jul 23 23:48:40 2003
@@ -170,6 +170,9 @@
 include/gc_pthread_redirects.h include/gc_config_macros.h \
 include/leak_detector.h include/gc_typed.h @addincludes@

+include_PRIVATE_HEADERS = include/private/gc_hdrs.h \
+include/private/gc_locks.h include/private/gc_priv.h \
+include/private/gcconfig.h

 EXTRA_HEADERS = include/gc_cpp.h include/gc_allocator.h

@@ -541,6 +544,13 @@
 	  f="`echo $$p | sed -e 's|^.*/||'`"; \
 	  echo " $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f"; \
 	  $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f; \
+	done
+	$(mkinstalldirs) $(DESTDIR)$(pkgincludedir)/private
+	@list='$(include_PRIVATE_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  echo " $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(pkgincludedir)/private/$$f"; \
+	  $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(pkgincludedir)/private/$$f; \
 	done

 uninstall-includeHEADERS:
$NetBSD: patch-ag,v 1.6 2003/12/03 00:14:16 recht Exp $

--- os_dep.c.orig	2003-06-13 21:11:00.000000000 +0200
+++ os_dep.c	2003-11-29 00:34:48.000000000 +0100
@@ -121,7 +121,7 @@
 # include <fcntl.h>
 #endif

-#if defined(SUNOS5SIGS) || defined (HURD) || defined(LINUX)
+#if defined(SUNOS5SIGS) || defined (HURD) || defined(LINUX) || defined(NETBSD)
 # ifdef SUNOS5SIGS
 #  include <sys/siginfo.h>
 # endif
@@ -688,9 +688,11 @@
 	typedef void (*handler)();
 #   endif

-#   if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) || defined(HURD)
+#   if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \
+    || defined(HURD) || defined(NETBSD)
 	static struct sigaction old_segv_act;
-#	if defined(_sigargs) /* !Irix6.x */ || defined(HPUX) || defined(HURD)
+#	if defined(_sigargs) /* !Irix6.x */ || defined(HPUX) \
+	|| defined(HURD) || defined(NETBSD)
 	    static struct sigaction old_bus_act;
 #	endif
 #   else
@@ -705,11 +707,11 @@
 #   endif
     {
 #	if defined(SUNOS5SIGS) || defined(IRIX5)  \
-        || defined(OSF1) || defined(HURD)
+        || defined(OSF1) || defined(HURD) || defined(NETBSD)
 	  struct sigaction	act;

 	  act.sa_handler	= h;
-#	  ifdef SUNOS5SIGS
+#	  if defined(SUNOS5SIGS) || defined(NETBSD)
             act.sa_flags          = SA_RESTART | SA_NODEFER;
 #         else
             act.sa_flags          = SA_RESTART;
@@ -729,7 +731,7 @@
 #	  else
 	        (void) sigaction(SIGSEGV, &act, &old_segv_act);
 #		if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
-		   || defined(HPUX) || defined(HURD)
+		   || defined(HPUX) || defined(HURD) || defined(NETBSD)
 		    /* Under Irix 5.x or HP/UX, we may get SIGBUS.	*/
 		    /* Pthreads doesn't exist under Irix 5.x, so we	*/
 		    /* don't have to worry in the threads case.		*/
@@ -765,10 +767,10 @@
     void GC_reset_fault_handler()
     {
 #       if defined(SUNOS5SIGS) || defined(IRIX5) \
-	   || defined(OSF1) || defined(HURD)
+	   || defined(OSF1) || defined(HURD) || defined(NETBSD)
 	  (void) sigaction(SIGSEGV, &old_segv_act, 0);
 #	  if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
-	     || defined(HPUX) || defined(HURD)
+	     || defined(HPUX) || defined(HURD) || defined(NETBSD)
 	      (void) sigaction(SIGBUS, &old_bus_act, 0);
 #	  endif
 #       else

-- 
NetBSD - because Unix isn't just #include <linux.h>, i386, ILP32, ELF, ...!


More information about the Gc mailing list