Skip to content

Commit

Permalink
boehm-gc pkgsrc from NetBSD-current
Browse files Browse the repository at this point in the history
  • Loading branch information
itojun committed Oct 4, 1999
1 parent f720d45 commit 8e5b747
Show file tree
Hide file tree
Showing 9 changed files with 362 additions and 0 deletions.
22 changes: 22 additions & 0 deletions netbsd/pkgsrc/devel/boehm-gc/Makefile
@@ -0,0 +1,22 @@
# $NetBSD: Makefile,v 1.11 1999/05/24 20:39:37 tv Exp $
# FreeBSD Id: Makefile,v 1.1 1996/11/16 01:51:25 jdp Exp
#

DISTNAME= gc4.12
PKGNAME= boehm-gc-4.12
CATEGORIES= devel
MASTER_SITES= http://reality.sgi.com/employees/boehm_mti/gc_source/

MAINTAINER= packages@netbsd.org
HOMEPAGE= http://reality.sgi.com/employees/boehm_mti/gc.html

NOT_FOR_PLATFORM= *-*-sparc # SEGV in "./test_cpp 1" in build: target
NOT_FOR_PLATFORM+= *-*-alpha # needs dlopen, ELF, still SEGV's

WRKSRC= ${WRKDIR}/gc
ALL_TARGET= BSD-pkg-all
INSTALL_TARGET= BSD-pkg-install
MAKE_ENV+= CP="${CP}" INSTALL_DATA="${INSTALL_DATA}" \
INSTALL_MAN="${INSTALL_MAN}"

.include "../../mk/bsd.pkg.mk"
3 changes: 3 additions & 0 deletions netbsd/pkgsrc/devel/boehm-gc/files/md5
@@ -0,0 +1,3 @@
$NetBSD: md5,v 1.3 1998/08/07 13:21:23 agc Exp $

MD5 (gc4.12.tar.gz) = 4bd802b9f586cac4a841b4730a6f3449
5 changes: 5 additions & 0 deletions netbsd/pkgsrc/devel/boehm-gc/files/patch-sum
@@ -0,0 +1,5 @@
$NetBSD: patch-sum,v 1.1 1999/07/09 13:50:32 agc Exp $

MD5 (patch-aa) = a87d073f91bccbb59314c4517952be50
MD5 (patch-ab) = 9cbea562a16550e27f2a48a3303234a7
MD5 (patch-ac) = 28b3827fd6202e0d39aa65e77de3d820
71 changes: 71 additions & 0 deletions netbsd/pkgsrc/devel/boehm-gc/patches/patch-aa
@@ -0,0 +1,71 @@
$NetBSD: patch-aa,v 1.3 1998/08/07 10:40:22 agc Exp $

--- Makefile.orig Thu Aug 21 01:17:10 1997
+++ Makefile Thu Feb 26 16:36:41 1998
@@ -8,15 +8,35 @@
# c++ interface to gc.a
# cord/de - builds dumb editor based on cords.
CC=cc
-CXX=CC
+CXX=c++
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
+CFLAGS= -O -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DATOMIC_UNCOLLECTABLE \
+ -DNO_EXECUTE_PERMISSION -DSILENT -DREDIRECT_MALLOC=GC_malloc

+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 CFLAGS="$(LEAKFLAGS)" clean c++-nt
+ mv gc.a bsd-libleak.a
+
+BSD-pkg-install: BSD-pkg-all
+ ${CP} bsd-libgc.a libgc.a
+ ${CP} bsd-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.
# -DSILENT disables statistics printing, and improves performance.
@@ -162,8 +182,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 +228,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
74 changes: 74 additions & 0 deletions netbsd/pkgsrc/devel/boehm-gc/patches/patch-ab
@@ -0,0 +1,74 @@
$NetBSD: patch-ab,v 1.3 1998/08/07 10:40:22 agc Exp $

*** gc.man.orig Fri Nov 15 08:56:14 1996
--- gc.man Fri Nov 15 09:30:14 1996
***************
*** 9,15 ****
... malloc(...) ...
.br
.sp
! cc ... gc.a
.LP
.SH DESCRIPTION
.I GC_malloc
--- 9,17 ----
... malloc(...) ...
.br
.sp
! cc ... -lgc
! .sp
! cc ... -lleak
.LP
.SH DESCRIPTION
.I GC_malloc
***************
*** 67,72 ****
--- 69,116 ----
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 probably be found in
+ .I /usr/local/include,
+ and the libraries in
+ .I /usr/local/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.)
157 changes: 157 additions & 0 deletions netbsd/pkgsrc/devel/boehm-gc/patches/patch-ac
@@ -0,0 +1,157 @@
$NetBSD: patch-ac,v 1.1 1998/09/06 16:06:58 christos Exp $

*** config.h.orig Wed Aug 20 20:01:31 1997
--- config.h Sun Sep 6 10:23:41 1998
***************
*** 92,98 ****
# endif
# if defined(sparc) && defined(unix) && !defined(sun)
# define SPARC
! # define DRSNX
# define mach_type_known
# endif
# if defined(_IBMR2)
--- 92,102 ----
# endif
# if defined(sparc) && defined(unix) && !defined(sun)
# define SPARC
! # if defined(__NetBSD__)
! # define SUNOS4 /* XXX */
! # else
! # define DRSNX
! # endif
# define mach_type_known
# endif
# if defined(_IBMR2)
*** dyn_load.c.orig Sun Sep 6 10:37:47 1998
--- dyn_load.c Sun Sep 6 10:58:20 1998
***************
*** 62,67 ****
--- 62,99 ----
#endif
#ifdef SUNOS4
# include <dlfcn.h>
+ # ifdef __NetBSD__
+ # include <nlist.h>
+ # define link_dynamic _dynamic
+ # define link_dynamic_2 section_dispatch_table
+ # define ld_2 d_sdt
+ # define ld_1 d_sdt
+ # define ld_version d_version
+ # define ld_un d_un
+
+ # define ldd d_debug
+ # define ldd_cp dd_cc
+
+ # define rtc_symb rt_symbol
+ # define rtc_next rt_next
+ # define rtc_sp rt_sp->nlist
+ # define RTC_DEREF .
+
+ # define ld_loaded sdt_loaded
+ # define ld_stab sdt_nzlist
+ # define ld_symbols sdt_strings
+ # define ld_symb_size sdt_str_sz
+ # define ld_loaded sdt_loaded
+
+
+ # define link_map so_map
+ # define lm_addr som_addr
+ # define lm_next som_next
+ # define lm_ld som_dynamic
+ # define lm_name som_path
+ # else
+ # define RTC_DEREF ->
+ # endif
# include <link.h>
# include <a.out.h>
/* struct link_map field overrides */
***************
*** 150,157 ****
curr_symbol = _DYNAMIC.ldd -> ldd_cp;
for (; curr_symbol != 0; curr_symbol = curr_symbol -> rtc_next) {
if (result == 0
! || (ptr_t)(curr_symbol -> rtc_sp -> n_value) < result) {
! result = (ptr_t)(curr_symbol -> rtc_sp -> n_value);
}
}
return(result);
--- 184,191 ----
curr_symbol = _DYNAMIC.ldd -> ldd_cp;
for (; curr_symbol != 0; curr_symbol = curr_symbol -> rtc_next) {
if (result == 0
! || (ptr_t)(curr_symbol -> rtc_sp RTC_DEREF n_value) < result) {
! result = (ptr_t)(curr_symbol -> rtc_sp RTC_DEREF n_value);
}
}
return(result);
*** mach_dep.c.orig Wed Aug 20 19:11:03 1997
--- mach_dep.c Sun Sep 6 10:19:54 1998
***************
*** 347,353 ****
--- 347,357 ----
# ifdef SVR4
asm(" .globl GC_save_regs_in_stack");
asm("GC_save_regs_in_stack:");
+ # ifdef __NetBSD__
+ asm(" .type GC_save_regs_in_stack,@function");
+ # else
asm(" .type GC_save_regs_in_stack,#function");
+ # endif
# else
asm(" .globl _GC_save_regs_in_stack");
asm("_GC_save_regs_in_stack:");
***************
*** 380,386 ****
--- 384,394 ----
# else
asm(".globl GC_clear_stack_inner");
asm("GC_clear_stack_inner:");
+ #ifdef __NetBSD__
+ asm(".type GC_save_regs_in_stack,@function");
+ #else
asm(".type GC_save_regs_in_stack,#function");
+ #endif
# endif
asm("mov %sp,%o2"); /* Save sp */
asm("add %sp,-8,%o3"); /* p = sp-8 */
*** os_dep.c.orig Sun Sep 6 10:27:43 1998
--- os_dep.c Sun Sep 6 10:35:24 1998
***************
*** 1390,1398 ****
char * addr;
# ifdef SUNOS4
# define SIG_OK (sig == SIGSEGV || sig == SIGBUS)
! # define CODE_OK (FC_CODE(code) == FC_PROT \
|| (FC_CODE(code) == FC_OBJERR \
&& FC_ERRNO(code) == FC_PROT))
# endif
# ifdef FREEBSD
# define SIG_OK (sig == SIGBUS)
--- 1390,1402 ----
char * addr;
# ifdef SUNOS4
# define SIG_OK (sig == SIGSEGV || sig == SIGBUS)
! # if defined(__NetBSD__)
! # define CODE_OK TRUE
! # else
! # define CODE_OK (FC_CODE(code) == FC_PROT \
|| (FC_CODE(code) == FC_OBJERR \
&& FC_ERRNO(code) == FC_PROT))
+ # endif
# endif
# ifdef FREEBSD
# define SIG_OK (sig == SIGBUS)
***************
*** 2093,2098 ****
--- 2097,2106 ----
#if defined(SPARC)
# if defined(SUNOS4)
# include <machine/frame.h>
+ # if defined(__NetBSD__)
+ # define fr_savpc fr_pc
+ # define fr_savfp fr_fp
+ # endif
# else
# if defined (DRSNX)
# include <sys/sparc/frame.h>
1 change: 1 addition & 0 deletions netbsd/pkgsrc/devel/boehm-gc/pkg/COMMENT
@@ -0,0 +1 @@
Garbage collection and memory leak detection for C and C++.
23 changes: 23 additions & 0 deletions netbsd/pkgsrc/devel/boehm-gc/pkg/DESCR
@@ -0,0 +1,23 @@
The Boehm-Weiser garbage collection package, for C and C++ -
garbage collection and memory leak detection libraries.

A garbage collector is something which automatically frees malloc'd
memory for you by working out what parts of memory your program
no longer has pointers to. As a result, garbage collectors can also
inform you of memory leaks (if they find memory they can free, it means
you have lost all of your pointers to it, but you didn't free it).

This package has two libraries and some include files:
libgc.a - a garbage collection library, replaces malloc/free/new/delete/etc
with versions that do automatic garbage collection
libleak.a - a leak detection library, which is just libgc.a compiled with
different switches.

C programs may be linked against either of these, and should run (with
GC or leak detection) without change. C++ programs must include a header
to use garbage collection, though leak detection should work without
such source code modifications. See the man page and header files.

-- Mike McGaughey <mmcg@cs.monash.edu.au>

ps: garbage collection is addictive.
6 changes: 6 additions & 0 deletions netbsd/pkgsrc/devel/boehm-gc/pkg/PLIST
@@ -0,0 +1,6 @@
@comment $NetBSD: PLIST,v 1.2 1997/11/06 09:59:06 agc Exp $
include/gc.h
include/gc_cpp.h
lib/libgc.a
lib/libleak.a
man/man3/gc.3.gz

0 comments on commit 8e5b747

Please sign in to comment.