update to 6.0

misc pieces from art@, pval@, and myself
This commit is contained in:
todd 2002-08-27 15:41:30 +00:00
parent 15d1d85064
commit fe065080cd
15 changed files with 238 additions and 304 deletions

View File

@ -1,18 +1,15 @@
# $OpenBSD: Makefile,v 1.17 2002/03/01 03:49:08 brad Exp $
# $OpenBSD: Makefile,v 1.18 2002/08/27 15:41:30 todd Exp $
# $FreeBSD: Makefile,v 1.4 1999/01/10 20:12:06 steve Exp $
COMMENT= "garbage collection and memory leak detection for C and C++"
ONLY_FOR_ARCHS= i386 m68k sparc
DISTNAME= gc4.12
PKGNAME= boehm-gc-4.12
VERSION= 6.0
DISTNAME= gc${VERSION}
PKGNAME= boehm-gc-${VERSION}
CATEGORIES= devel
NEED_VERSION= 1.500
MASTER_SITES= ${MASTER_SITE_BACKUP}
EXTRACT_CASES= gc4.12.tar.gz) tar zxf ${FULLDISTDIR}/$$archive || true;;
MASTER_SITES= ${HOMEPAGE}gc_source/
HOMEPAGE= http://ginger.hpl.hp.com/personal/Hans_Boehm/gc/
HOMEPAGE= http://www.hpl.hp.com/personal/Hans_Boehm/gc/
MAINTAINER= Niklas Hallqvist <niklas@openbsd.org>
@ -25,14 +22,19 @@ MAKE_ENV= CP="cp" \
INSTALL_DATA="${INSTALL_DATA}" \
INSTALL_MAN="${INSTALL_MAN}"
ALL_TARGET= OpenBSD-pkg-all
INSTALL_TARGET= OpenBSD-pkg-install
CONFIGURE_STYLE=gnu
WRKDIST= ${WRKDIR}/gc
WRKDIST= ${WRKDIR}/gc6.0
post-patch:
@mv ${WRKSRC}/gc.man ${WRKSRC}/gc.man.in
@sed -e "s,@PREFIX@,${PREFIX},g" ${WRKSRC}/gc.man.in > \
${WRKSRC}/gc.man
@mv ${WRKSRC}/doc/gc.man ${WRKSRC}/doc/gc.man.in
@sed -e "s,@PREFIX@,${PREFIX},g" ${WRKSRC}/doc/gc.man.in > \
${WRKSRC}/doc/gc.man
post-install:
${INSTALL_DATA} ${WRKSRC}/doc/gc.man ${PREFIX}/man/man3/gc.3
${INSTALL_DATA} ${WRKSRC}/include/gc{,_cpp}.h ${PREFIX}/include
REGRESS_TARGET= check-TESTS
.include <bsd.port.mk>

View File

@ -1,3 +1,3 @@
SHA1 (gc4.12.tar.gz) = b3888ad7d01d60561f809a3c30e3317964752475
RMD160 (gc4.12.tar.gz) = 2f69c346cdc0b44ffd3e5989575ea400d4202a3c
MD5 (gc4.12.tar.gz) = 4bd802b9f586cac4a841b4730a6f3449
MD5 (gc6.0.tar.gz) = 528371164ac9838dcb263fede456eff6
RMD160 (gc6.0.tar.gz) = 51d6001d7a6d88f6f9ab4e9dbf3d38352b2460cc
SHA1 (gc6.0.tar.gz) = 9698826b33472b314d7b2eb640c1669ce05f5277

View File

@ -1,84 +0,0 @@
--- Makefile.orig Thu Aug 21 02:17:10 1997
+++ Makefile Fri Mar 23 14:43:41 2001
@@ -7,15 +7,41 @@
# and runs some tests of collector and cords. Does not add cords or
# c++ interface to gc.a
# cord/de - builds dumb editor based on cords.
-CC=cc
-CXX=CC
+#CC=cc
+#CXX=CC
AS=as
# The above doesn't work with gas, which doesn't run cpp.
# Define AS as `gcc -c -x assembler-with-cpp' instead.
# Under Irix 6, you will have to specify the ABI for as if you specify
# it for the C compiler.
-CFLAGS= -O -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DATOMIC_UNCOLLECTABLE -DNO_EXECUTE_PERMISSION -DSILENT
+# We want this to be a drop-in linkable library, hence the -DREDIRECT.
+# The new c++-t and c++-nt (test and notest) are because we don't want
+# to fill anyone's log with leak messages! - MMCG
+
+CFLAGS+= -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DATOMIC_UNCOLLECTABLE \
+ -DNO_EXECUTE_PERMISSION -DSILENT -DREDIRECT_MALLOC=GC_malloc
+
+LEAKFLAGS=$(CFLAGS) -DFIND_LEAK
+
+all: gc.a gctest
+
+OpenBSD-pkg-all: obsd-libgc.a obsd-libleak.a
+
+obsd-libgc.a:
+ make CFLAGS="$(CFLAGS)" clean c++-t
+ mv gc.a obsd-libgc.a
+
+obsd-libleak.a:
+ make CFLAGS="$(LEAKFLAGS)" clean c++-nt
+ mv gc.a obsd-libleak.a
+
+OpenBSD-pkg-install: OpenBSD-pkg-all
+ ${CP} obsd-libgc.a libgc.a
+ ${CP} obsd-libleak.a libleak.a
+ ${INSTALL_DATA} libleak.a libgc.a ${PREFIX}/lib
+ ${INSTALL_DATA} gc.h gc_cpp.h ${PREFIX}/include
+ ${INSTALL_MAN} gc.man ${PREFIX}/man/man3/gc.3
# Setjmp_test may yield overly optimistic results when compiled
# without optimization.
@@ -100,7 +126,6 @@
-DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS
# Flags for building libgc.a -- the last two are required.
-CXXFLAGS= $(CFLAGS)
AR= ar
RANLIB= ranlib
@@ -162,8 +187,6 @@
# not time-critical anyway.
# Set SPECIALCFLAGS to -q nodirect_code on Encore.
-all: gc.a gctest
-
pcr: PCR-Makefile gc_private.h gc_hdrs.h gc.h config.h mach_dep.o $(SRCS)
make -f PCR-Makefile depend
make -f PCR-Makefile
@@ -210,13 +233,18 @@
./if_mach HP_PA "" $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/test_cpp.cc gc_cpp.o gc.a -ldld
./if_not_there test_cpp $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/test_cpp.cc gc_cpp.o gc.a `./threadlibs`
+c++-t: c++
+ ./test_cpp 1
+
+c++-nt: c++
+ @echo "Use ./test_cpp 1 to test the leak library"
+
c++: gc_cpp.o $(srcdir)/gc_cpp.h test_cpp
rm -f on_sparc_sunos5
./if_mach SPARC SUNOS5 touch on_sparc_sunos5
./if_mach SPARC SUNOS5 $(AR) rus gc.a gc_cpp.o
./if_not_there on_sparc_sunos5 $(AR) ru gc.a gc_cpp.o
./if_not_there on_sparc_sunos5 $(RANLIB) gc.a || cat /dev/null
- ./test_cpp 1
echo > c++
dyn_load_sunos53.o: dyn_load.c

View File

@ -1,21 +0,0 @@
--- gc_priv.h.orig Wed Aug 20 16:22:54 1997
+++ gc_priv.h Mon Apr 6 03:25:55 1998
@@ -49,6 +49,10 @@
# include "gc_hdrs.h"
# endif
+# ifdef __cplusplus
+# define TRUE true
+# define FALSE false
+# else
# if !defined(bool) && !defined(__cplusplus)
typedef int bool;
/* This is problematic with C++ implementations that do not define bool. */
@@ -67,6 +71,7 @@
# endif
# define TRUE 1
# define FALSE 0
+# endif
typedef char * ptr_t; /* A generic pointer to which we can add */
/* byte displacements. */

View File

@ -1,130 +0,0 @@
--- config.h.orig Wed Aug 20 20:01:31 1997
+++ config.h Tue Oct 5 20:14:10 1999
@@ -22,6 +22,11 @@
/* Machine specific parts contributed by various people. See README file. */
+# if defined(__OpenBSD__)
+# define OPENBSD
+# define unix /* symbol unix is no longer defined in OpenBSD */
+# endif
+
/* Determine the machine type: */
# if defined(sun) && defined(mc68000)
# define M68K
@@ -38,6 +43,10 @@
# define NETBSD
# define mach_type_known
# endif
+# if defined(__OpenBSD__) && defined(__m68k__)
+# define M68K
+# define mach_type_known
+# endif
# if defined(vax)
# define VAX
# ifdef ultrix
@@ -49,7 +58,7 @@
# endif
# if defined(mips) || defined(__mips)
# define MIPS
-# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
+# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__) || defined(__OpenBSD__)
# define ULTRIX
# else
# if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4__)
@@ -90,7 +99,7 @@
# endif
# define mach_type_known
# endif
-# if defined(sparc) && defined(unix) && !defined(sun)
+# if defined(sparc) && defined(unix) && !defined(sun) && !defined(__OpenBSD__)
# define SPARC
# define DRSNX
# define mach_type_known
@@ -99,6 +108,10 @@
# define RS6000
# define mach_type_known
# endif
+# if defined(__OpenBSD__) && defined(__sparc__)
+# define SPARC
+# define mach_type_known
+# endif
# if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
/* The above test may need refinement */
# define I386
@@ -168,6 +181,10 @@
# define NETBSD
# define mach_type_known
# endif
+# if defined(__OpenBSD__) && defined(__i386__)
+# define I386
+# define mach_type_known
+# endif
# if defined(bsdi) && defined(i386)
# define I386
# define BSDI
@@ -247,8 +264,9 @@
/* MACOS and AMIGA variants) */
/* I386 ==> Intel 386 */
/* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
- /* FREEBSD, THREE86BSD, MSWIN32, */
- /* BSDI, SUNOS5, NEXT variants) */
+ /* FREEBSD, THREE86BSD, OPENBSD, */
+ /* BSDI, SUNOS5, NEXT variants, */
+ /* MSWIN32) */
/* NS32K ==> Encore Multimax */
/* MIPS ==> R2000 or R3000 */
/* (RISCOS, ULTRIX variants) */
@@ -361,6 +379,11 @@
# define ALIGNMENT 2
# ifdef NETBSD
# define OS_TYPE "NETBSD"
+# endif
+# ifdef OPENBSD
+# define OS_TYPE "OPENBSD"
+# endif
+# if defined(NETBSD) || defined(OPENBSD)
# define HEURISTIC2
extern char etext;
# define DATASTART ((ptr_t)(&etext))
@@ -521,7 +544,12 @@
# define MPROTECT_VDB
# define STACKBOTTOM ((ptr_t) 0xdfff0000)
# endif
-# define DYNAMIC_LOADING
+/*# define DYNAMIC_LOADING */
+# ifdef OPENBSD
+# define OS_TYPE "OPENBSD"
+# define HEURISTIC2
+# define DATASTART ((ptr_t)(&etext))
+# endif
# endif
# ifdef I386
@@ -639,13 +667,16 @@
# ifdef NETBSD
# define OS_TYPE "NETBSD"
# endif
+# ifdef OPENBSD
+# define OS_TYPE "OPENBSD"
+# endif
# ifdef THREE86BSD
# define OS_TYPE "THREE86BSD"
# endif
# ifdef BSDI
# define OS_TYPE "BSDI"
# endif
-# if defined(FREEBSD) || defined(NETBSD) \
+# if defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|| defined(THREE86BSD) || defined(BSDI)
# define HEURISTIC2
extern char etext;
@@ -916,7 +947,7 @@
# define THREADS
# endif
-# if defined(SPARC)
+# if defined(SPARC) && !defined(OPENBSD)
# define SAVE_CALL_CHAIN
# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
/* include assembly code to do it well. */

View File

@ -1,19 +0,0 @@
--- dbg_mlc.c.orig Tue Apr 22 20:06:56 1997
+++ dbg_mlc.c Tue Apr 20 09:59:53 1999
@@ -386,7 +386,7 @@
{
register GC_PTR base = GC_base(p);
register ptr_t clobbered;
- register GC_PTR result = GC_debug_malloc(lb, s, i);
+ register GC_PTR result;
register size_t copy_sz = lb;
register size_t old_sz;
register hdr * hhdr;
@@ -432,6 +432,7 @@
if (old_sz < copy_sz) copy_sz = old_sz;
if (result == 0) return(0);
BCOPY(p, result, copy_sz);
+ GC_debug_free(p);
return(result);
}

View File

@ -1,11 +0,0 @@
--- os_dep.c.orig Tue Oct 5 20:22:04 1999
+++ os_dep.c Tue Oct 5 20:22:22 1999
@@ -2090,7 +2090,7 @@
* Call stack save code for debugging.
* Should probably be in mach_dep.c, but that requires reorganization.
*/
-#if defined(SPARC)
+#if defined(SPARC) && !defined(__OpenBSD__)
# if defined(SUNOS4)
# include <machine/frame.h>
# else

View File

@ -1,21 +1,10 @@
--- gc.man.orig Mon Feb 12 17:34:12 1996
+++ gc.man Tue Oct 5 19:50:08 1999
@@ -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.
$OpenBSD: patch-doc_gc_man,v 1.1 2002/08/27 15:41:30 todd Exp $
--- doc/gc.man.orig Wed Sep 22 01:55:00 1999
+++ doc/gc.man Sat Jul 27 01:04:55 2002
@@ -68,6 +68,48 @@ This may temporarily write protect pages
.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
.LP
+.SH "PORT INFORMATION"
+.LP
+In this (OpenBSD package) installation,
@ -23,9 +12,9 @@
+and
+.I gc_cpp.h
+will probably be found in
+.I @PREFIX@/include,
+.I /usr/local/include,
+and the libraries in
+.I @PREFIX@/lib.
+.I /usr/local/lib.
+.LP
+These libraries have been compiled as drop-in replacements
+for malloc and free (which is to say, all malloc
@ -57,6 +46,7 @@
+extension of
+.I g++.
+This may or may not make a difference.
.LP
+.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.)
.LP

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-dyn_load_c,v 1.1 2002/08/27 15:41:30 todd Exp $
--- dyn_load.c.orig Tue Jun 26 04:37:38 2001
+++ dyn_load.c Wed Jul 31 05:06:30 2002
@@ -53,6 +53,7 @@
!(defined(ALPHA) && defined(OSF1)) && \
!defined(HPUX) && !(defined(LINUX) && defined(__ELF__)) && \
!defined(RS6000) && !defined(SCO_ELF) && \
+ !(defined(OPENBSD) && defined(__ELF__)) && \
!(defined(NETBSD) && defined(__ELF__)) && !defined(HURD)
--> We only know how to find data segments of dynamic libraries for the
--> above. Additional SVR4 variants might not be too
@@ -243,6 +244,7 @@ void GC_register_dynamic_libraries()
# endif /* SUNOS */
#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
+ (defined(OPENBSD) && defined(__ELF__)) || \
(defined(NETBSD) && defined(__ELF__)) || defined(HURD)
@@ -424,7 +426,7 @@ static char *parse_map_entry(char *buf_p
* This code was derived from the Solaris/ELF support. Thanks to
* whatever kind soul wrote that. - Patrick Bridges */
-#if defined(NETBSD)
+#if defined(NETBSD) || defined(OPENBSD)
# include <sys/exec_elf.h>
#else
# include <elf.h>

View File

@ -0,0 +1,119 @@
$OpenBSD: patch-include_private_gcconfig_h,v 1.1 2002/08/27 15:41:30 todd Exp $
--- include/private/gcconfig.h.orig Thu Jul 26 19:28:57 2001
+++ include/private/gcconfig.h Wed Jul 31 07:45:46 2002
@@ -33,6 +33,10 @@
# define NETBSD
# endif
+# if defined(__OpenBSD__)
+# define OPENBSD
+# endif
+
/* Determine the machine type: */
# if defined(sun) && defined(mc68000)
# define M68K
@@ -46,12 +50,14 @@
# endif
# if defined(__OpenBSD__) && defined(m68k)
# define M68K
-# define OPENBSD
# define mach_type_known
# endif
# if defined(__OpenBSD__) && defined(__sparc__)
# define SPARC
-# define OPENBSD
+# define mach_type_known
+# endif
+# if defined(__OpenBSD__) && defined(__powerpc__)
+# define POWERPC
# define mach_type_known
# endif
# if defined(__NetBSD__) && defined(m68k)
@@ -196,7 +202,7 @@
# endif
# if defined(__alpha) || defined(__alpha__)
# define ALPHA
-# if !defined(LINUX) && !defined(NETBSD)
+# if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD)
# define OSF1 /* a.k.a Digital Unix */
# endif
# define mach_type_known
@@ -241,7 +247,6 @@
# endif
# if defined(__OpenBSD__) && (defined(i386) || defined(__i386__))
# define I386
-# define OPENBSD
# define mach_type_known
# endif
# if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
@@ -664,6 +669,14 @@
# define DATASTART GC_data_start
# define DYNAMIC_LOADING
# endif
+# ifdef OPENBSD
+# define ALIGNMENT 4
+# define OS_TYPE "OPENBSD"
+# define HEURISTIC2
+ extern char etext;
+# define DATASTART GC_data_start
+# define DYNAMIC_LOADING
+# endif
# ifdef NOSYS
# define ALIGNMENT 4
# define OS_TYPE "NOSYS"
@@ -793,9 +806,18 @@
# endif
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
-# define STACKBOTTOM ((ptr_t) 0xf8000000)
- extern int etext;
-# define DATASTART ((ptr_t)(&etext))
+# define HEURISTIC2
+# ifdef __arch64__
+# define CPP_WORDSZ 64
+# define ELF_CLASS ELFCLASS64
+# endif
+# ifdef __ELF__
+# define DATASTART GC_data_start
+# define DYNAMIC_LOADING
+# else
+ extern char etext;
+# define DATASTART ((ptr_t)(&etext))
+# endif
# endif
# ifdef NETBSD
# define OS_TYPE "NETBSD"
@@ -1000,6 +1022,9 @@
# endif
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
+# define HEURISTIC2
+ extern char etext;
+# define DATASTART ((ptr_t)(&etext))
# endif
# ifdef FREEBSD
# define OS_TYPE "FREEBSD"
@@ -1015,7 +1040,7 @@
# ifdef BSDI
# define OS_TYPE "BSDI"
# endif
-# if defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
+# if defined(NETBSD) || defined(FREEBSD) \
|| defined(THREE86BSD) || defined(BSDI)
# define HEURISTIC2
extern char etext;
@@ -1238,6 +1263,14 @@
# define DATASTART GC_data_start
# define ELFCLASS32 32
# define ELFCLASS64 64
+# define ELF_CLASS ELFCLASS64
+# define CPP_WORDSZ 64
+# define DYNAMIC_LOADING
+# endif
+# ifdef OPENBSD
+# define OS_TYPE "OPENBSD"
+# define HEURISTIC2
+# define DATASTART GC_data_start
# define ELF_CLASS ELFCLASS64
# define CPP_WORDSZ 64
# define DYNAMIC_LOADING

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-mach_dep_c,v 1.1 2002/08/27 15:41:30 todd Exp $
--- mach_dep.c.orig Wed Jun 27 22:54:23 2001
+++ mach_dep.c Wed Jul 31 05:04:41 2002
@@ -462,7 +462,7 @@ ptr_t cold_gc_frame;
/* the stack. Return sp. */
# ifdef SPARC
asm(" .seg \"text\"");
-# ifdef SVR4
+# if defined(SVR4) || defined(__ELF__)
asm(" .globl GC_save_regs_in_stack");
asm("GC_save_regs_in_stack:");
asm(" .type GC_save_regs_in_stack,#function");

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-misc_c,v 1.1 2002/08/27 15:41:30 todd Exp $
--- misc.c.orig Wed Jul 31 06:36:17 2002
+++ misc.c Wed Jul 31 06:35:36 2002
@@ -527,6 +527,9 @@ void GC_init_inner()
# if defined(NETBSD) && defined(__ELF__)
GC_init_netbsd_elf();
# endif
+# if defined(OPENBSD) && defined(__ELF__)
+ GC_init_openbsd_elf();
+# endif
# if defined(IRIX_THREADS) || defined(LINUX_THREADS) \
|| defined(HPUX_THREADS) || defined(SOLARIS_THREADS)
GC_thr_init();

View File

@ -0,0 +1,31 @@
$OpenBSD: patch-os_dep_c,v 1.1 2002/08/27 15:41:30 todd Exp $
--- os_dep.c.orig Thu Jul 26 20:39:45 2001
+++ os_dep.c Wed Jul 31 07:29:54 2002
@@ -232,6 +232,19 @@ static void *tiny_sbrk(ptrdiff_t increme
}
#endif
+#if defined(OPENBSD) && defined(__ELF__)
+ ptr_t GC_data_start;
+
+ void GC_init_openbsd_elf()
+ {
+ extern ptr_t GC_find_limit();
+ extern char **environ;
+ /* This may need to be environ, without the underscore, for */
+ /* some versions. */
+ GC_data_start = GC_find_limit((ptr_t)&environ, FALSE);
+ }
+#endif
+
# ifdef OS2
# include <stddef.h>
@@ -630,7 +643,6 @@ ptr_t GC_get_stack_base()
/* preserved across the longjmp. Can safely be */
/* static since it's only called once, with the */
/* allocation lock held. */
-
GC_setup_temporary_fault_handler();
if (setjmp(GC_jmp_buf) == 0) {

View File

@ -0,0 +1,3 @@
@comment $OpenBSD: PFRAG.shared,v 1.1 2002/08/27 15:41:30 todd Exp $
lib/libgc.so.1.1
DYNLIBDIR(%D/lib)

View File

@ -1,6 +1,7 @@
@comment $OpenBSD: PLIST,v 1.2 2000/10/26 20:10:15 marc Exp $
@comment $OpenBSD: PLIST,v 1.3 2002/08/27 15:41:30 todd Exp $
include/gc.h
include/gc_cpp.h
lib/libgc.a
lib/libleak.a
lib/libgc.la
man/man3/gc.3
%%SHARED%%