aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devel/boehm-gc/Makefile29
-rw-r--r--devel/boehm-gc/files/patch-dbg_mlc.c82
-rw-r--r--devel/boehm-gc/files/patch-include-gc.h10
3 files changed, 118 insertions, 3 deletions
diff --git a/devel/boehm-gc/Makefile b/devel/boehm-gc/Makefile
index 89cf1e484574..7a17d2b9e407 100644
--- a/devel/boehm-gc/Makefile
+++ b/devel/boehm-gc/Makefile
@@ -7,6 +7,7 @@
PORTNAME= boehm-gc
PORTVERSION= 6.2
+PORTREVISION= 1
CATEGORIES= devel
MASTER_SITES= http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/
DISTNAME= gc${PORTVERSION:S/.a/alpha/}
@@ -18,12 +19,34 @@ USE_LIBTOOL_VER= 13
USE_REINPLACE= yes
HAS_CONFIGURE= yes
INSTALLS_SHLIB= yes
-CONFIGURE_ARGS= --prefix=${PREFIX} --disable-threads --enable-cplusplus
-
-MAN3= gc.3
+CONFIGURE_ARGS= --prefix=${PREFIX} --enable-cplusplus
+OPTIONS= REDIRECT "Define malloc(3)-family replacements" no \
+ FULLDEBUG "full-debug support (see documentation)" no \
+ THREADING "POSIX thread support" no \
+ PARALLEL_MARK "Parallel-thread marking (faster for SMP)" yes
.include <bsd.port.pre.mk>
+.ifdef WITH_THREADING
+CONFIGURE_ARGS+= --enable-threads=posix --enable-thread-local-alloc
+.ifdef WITH_PARALLEL_MARK
+CONFIGURE_ARGS+= --enable-parallel-mark
+.endif
+PKGNAMESUFFIX= +threaded
+.else
+CONFIGURE_ARGS+= --disable-threads
+.endif
+.ifdef WITH_REDIRECT
+CONFIGURE_ARGS+= --enable-redirect-malloc
+PKGNAMESUFFIX:=${PKGNAMESUFFIX}+redirect
+.endif
+.ifdef WITH_FULLDEBUG
+CONFIGURE_ARGS+= --enable-full-debug
+PKGNAMESUFFIX:=${PKGNAMESUFFIX}+fulldebug
+.endif
+
+MAN3= gc.3
+
.if ${ARCH} != "i386" && ${ARCH} != "alpha" && ${ARCH} != "amd64"
BROKEN= "Does not compile on !i386 and !alpha and !amd64"
.endif
diff --git a/devel/boehm-gc/files/patch-dbg_mlc.c b/devel/boehm-gc/files/patch-dbg_mlc.c
new file mode 100644
index 000000000000..a3995703c004
--- /dev/null
+++ b/devel/boehm-gc/files/patch-dbg_mlc.c
@@ -0,0 +1,82 @@
+--- dbg_mlc.c.orig Tue May 13 16:59:49 2003
++++ dbg_mlc.c Wed May 12 20:13:19 2004
+@@ -414,6 +414,23 @@
+ GC_register_displacement((word)sizeof(oh) + offset);
+ }
+
++#if defined(__FreeBSD__)
++#include <dlfcn.h>
++static void GC_caller_func_offset(ad, symp, offp)
++const GC_word ad;
++const char **symp;
++int *offp;
++{
++ Dl_info caller;
++ if (dladdr((const void *)ad, &caller) && caller.dli_sname != NULL) {
++ *symp = caller.dli_sname;
++ *offp = (const char *)ad - (const char *)caller.dli_saddr;
++ }
++}
++#else
++#define GC_caller_func(ad, symp, offp)
++#endif
++
+ # ifdef __STDC__
+ GC_PTR GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
+ # else
+@@ -428,6 +445,13 @@
+ {
+ GC_PTR result = GC_malloc(lb + DEBUG_BYTES);
+
++#ifdef GC_ADD_CALLER
++ if (s == NULL) {
++ GC_caller_func_offset(ra, &s, &i);
++ if (s == NULL)
++ s = "unknown";
++ }
++#endif
+ if (result == 0) {
+ GC_err_printf1("GC_debug_malloc(%ld) returning NIL (",
+ (unsigned long) lb);
+@@ -789,6 +813,13 @@
+ register size_t old_sz;
+ register hdr * hhdr;
+
++#ifdef GC_ADD_CALLER
++ if (s == NULL) {
++ GC_caller_func_offset(ra, &s, &i);
++ if (s == NULL)
++ s = "unknown";
++ }
++#endif
+ if (p == 0) return(GC_debug_malloc(lb, OPT_RA s, i));
+ if (base == 0) {
+ GC_err_printf1(
+@@ -1094,7 +1125,11 @@
+ }
+
+ #ifdef GC_ADD_CALLER
+-# define RA GC_RETURN_ADDR,
++# ifdef GC_RETURN_ADDR_PARENT
++# define RA GC_RETURN_ADDR_PARENT,
++# else
++# define RA GC_RETURN_ADDR,
++# endif
+ #else
+ # define RA
+ #endif
+@@ -1102,12 +1137,12 @@
+ GC_PTR GC_debug_malloc_replacement(lb)
+ size_t lb;
+ {
+- return GC_debug_malloc(lb, RA "unknown", 0);
++ return GC_debug_malloc(lb, RA NULL, 0);
+ }
+
+ GC_PTR GC_debug_realloc_replacement(p, lb)
+ GC_PTR p;
+ size_t lb;
+ {
+- return GC_debug_realloc(p, lb, RA "unknown", 0);
++ return GC_debug_realloc(p, lb, RA NULL, 0);
+ }
diff --git a/devel/boehm-gc/files/patch-include-gc.h b/devel/boehm-gc/files/patch-include-gc.h
new file mode 100644
index 000000000000..44ee87d92268
--- /dev/null
+++ b/devel/boehm-gc/files/patch-include-gc.h
@@ -0,0 +1,10 @@
+--- include/gc.h.orig Wed Jun 4 17:07:33 2003
++++ include/gc.h Wed May 12 20:03:22 2004
+@@ -487,6 +487,7 @@
+ /* gcc knows how to retrieve return address, but we don't know */
+ /* how to generate call stacks. */
+ # define GC_RETURN_ADDR (GC_word)__builtin_return_address(0)
++# define GC_RETURN_ADDR_PARENT (GC_word)__builtin_return_address(1)
+ # else
+ /* Just pass 0 for gcc compatibility. */
+ # define GC_RETURN_ADDR 0