View | Details | Raw Unified | Return to bug 176716 | Differences between
and this patch

Collapse All | Expand All

(-)devel/boehm-gc/Makefile (-21 / +82 lines)
Lines 1-54 Link Here
1
# New ports collection makefile for:	boehm-gc
1
# Created by: Mike McGaughey <mmcg@cs.monash.edu.au>
2
# Date created:		15 November 1996
3
# Whom:			Mike McGaughey <mmcg@cs.monash.edu.au>
4
#
5
# $FreeBSD$
2
# $FreeBSD$
6
#
7
3
8
PORTNAME=	boehm-gc
4
PORTNAME=	gc
9
PORTVERSION=	7.1
5
PORTVERSION=	7.2d
10
PORTREVISION=	0
6
PORTREVISION?=	0
11
CATEGORIES=	devel
7
CATEGORIES=	devel
12
MASTER_SITES=	http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/
8
MASTER_SITES=	http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/
13
DISTNAME=	gc-${PORTVERSION:S/.a/alpha/}
9
PKGNAMEPREFIX=	boehm-
10
.ifdef GC_VARIANT
11
PKGNAMESUFFIX=	-${GC_VARIANT}
12
.endif
14
13
15
MAINTAINER=	ports@FreeBSD.org
14
MAINTAINER=	ports@FreeBSD.org
16
COMMENT=	Garbage collection and memory leak detection for C and C++
15
COMMENT=	Garbage collection and memory leak detection for C and C++
17
16
17
LICENSE=	MIT GPLv2
18
LICENSE_COMB=	multi
19
18
GNU_CONFIGURE=	yes
20
GNU_CONFIGURE=	yes
19
USE_GNOME=	gnomehack
21
USE_GNOME=	gnomehack
20
USE_LDCONFIG=	yes
22
USE_LDCONFIG=	yes
21
CONFIGURE_ARGS=	--enable-cplusplus --disable-static --disable-threads
23
CONFIGURE_ARGS=	--enable-cplusplus --disable-static
22
MAKE_JOBS_UNSAFE=	yes
24
MAKE_JOBS_UNSAFE=	yes
23
OPTIONS_DEFINE=	DEBUG
24
25
25
.include <bsd.port.pre.mk>
26
WRKSRC=		${WRKDIR}/${DISTNAME:C/[a-z]$//}
26
27
28
OPTIONS_DEFINE=		DEBUG
29
DEBUG_DESC=		Additional debugging support (see documentation)
30
31
.ifdef GC_VARIANT
32
INSTLIBS=		cord gc gccpp
33
OPTIONS_EXCLUDE+=	DOCS
34
PLIST=			${NONEXISTENT}
35
PLIST_FILES=		${INSTLIBS:S,^,lib/lib,g:S,$,-${GC_VARIANT}.so.${SOVER},g} \
36
			${INSTLIBS:S,^,lib/lib,g:S,$,-${GC_VARIANT}.so,g} \
37
			libdata/pkgconfig/bdw-gc-${GC_VARIANT}.pc
38
RUN_DEPENDS+=		${LOCALBASE}/include/gc/gc.h:${PORTSDIR}/devel/boehm-gc
39
SOVER=			1
40
. if ${GC_VARIANT} == "redirect"
41
CONFIGURE_ARGS+=	--disable-threads --enable-redirect-malloc
42
. endif
43
. if ${GC_VARIANT} == "threaded"
44
CONFIGURE_ARGS+=	--enable-threads=posix --disable-redirect-malloc
45
OPTIONS_DEFINE+=	PARALLEL_MARK
46
PARALLEL_MARK_DESC=	Parallel-thread marking (faster for SMP)
47
UNIQUENAME=		${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
48
. endif
49
.else
50
CONFIGURE_ARGS+=	--disable-threads --disable-redirect-malloc
51
MAN3=			gc.3
52
PORTDOCS=		*
53
.endif
54
55
.include <bsd.port.options.mk>
56
27
.if ${PORT_OPTIONS:MDEBUG}
57
.if ${PORT_OPTIONS:MDEBUG}
28
CONFIGURE_ARGS+=	--enable-gc-debug
58
CONFIGURE_ARGS+=	--enable-gc-debug
29
PKGNAMESUFFIX:=		${PKGNAMESUFFIX}+fulldebug
59
PKGNAMESUFFIX:=		${PKGNAMESUFFIX}+fulldebug
30
.endif
60
.endif
31
61
32
MAN3=		gc.3
62
.if ! ${PORT_OPTIONS:MDOCS}
63
CONFIGURE_ARGS+=	--datarootdir=${WRKDIR}/doc
64
.endif
33
65
34
.if ${ARCH} == "ia64"
66
.if defined(GC_VARIANT) && ${GC_VARIANT} == "threaded"
35
BROKEN=	Does not compile on ia64
67
. if ${PORT_OPTIONS:MPARALLEL_MARK}
68
CONFIGURE_ARGS+=	--enable-parallel-mark
69
. endif
36
.endif
70
.endif
37
71
72
.include <bsd.port.pre.mk>
73
74
NOT_FOR_ARCHS=	ia64
75
76
.ifdef GC_VARIANT
38
post-patch:
77
post-patch:
78
	@${REINPLACE_CMD} -e \
79
		's,libgc\.la,libgc-${GC_VARIANT}.la,g ; \
80
		 s,libgccpp\.la,libgccpp-${GC_VARIANT}.la,g ; \
81
		 s,libcord\.la,libcord-${GC_VARIANT}.la,g' ${WRKSRC}/Makefile.in
82
	@${REINPLACE_CMD} -e \
83
		's,-lgc,-lgc-${GC_VARIANT},' ${WRKSRC}/bdw-gc.pc.in
84
85
do-install:
86
.for LIB in ${INSTLIBS}
87
	${INSTALL_DATA} ${WRKSRC}/.libs/lib${LIB}-${GC_VARIANT}.so.${SOVER} \
88
		${PREFIX}/lib/lib${LIB}-${GC_VARIANT}.so.${SOVER}
89
	${LN} -sf lib${LIB}-${GC_VARIANT}.so.${SOVER} \
90
		${PREFIX}/lib/lib${LIB}-${GC_VARIANT}.so
91
.endfor
92
	${INSTALL_DATA} ${WRKSRC}/bdw-gc.pc \
93
		${PREFIX}/libdata/pkgconfig/bdw-gc-${GC_VARIANT}.pc
94
95
.else # ! GC_VARIANT
96
post-patch:
39
	@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/doc/gc.man
97
	@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/doc/gc.man
98
	@${REINPLACE_CMD} \
99
		-e "s|(datadir)/@PACKAGE@|(datadir)/doc/@PACKAGE@|" \
100
		${WRKSRC}/Makefile.in
40
101
41
#
102
post-install:
103
	${INSTALL_MAN} ${WRKSRC}/doc/gc.man ${MAN3PREFIX}/man/man3/gc.3
104
105
.endif
106
42
# Get rid of .la and static library files
107
# Get rid of .la and static library files
43
#
44
post-configure:
108
post-configure:
45
	@${REINPLACE_CMD} -E -e \
109
	@${REINPLACE_CMD} -E -e \
46
	'/Install the pseudo-library/,/staticlibs=/s,^,#,' ${WRKSRC}/libtool
110
	'/Install the pseudo-library/,/staticlibs=/s,^,#,' ${WRKSRC}/libtool
47
111
48
post-install:
112
regression-test: build
49
	${INSTALL_MAN} ${WRKSRC}/doc/gc.man ${PREFIX}/man/man3/gc.3
50
51
test: build
52
	cd ${WRKSRC} && ${MAKE} check
113
	cd ${WRKSRC} && ${MAKE} check
53
114
54
.include <bsd.port.post.mk>
115
.include <bsd.port.post.mk>
(-)devel/boehm-gc/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (gc-7.1.tar.gz) = e3cef6028fe3efe7de3bcf4107c880eae50b3ee79841450d885467c09bcebf30
1
SHA256 (gc-7.2d.tar.gz) = d9fe0ae8650d43746a48bfb394cab01a319f3809cee19f8ebd16aa985b511c5e
2
SIZE (gc-7.1.tar.gz) = 1077714
2
SIZE (gc-7.2d.tar.gz) = 1263064
(-)devel/boehm-gc/files/patch-Makefile.in (-11 lines)
Lines 1-11 Link Here
1
--- Makefile.in.orig	2009-10-20 01:25:20.000000000 +0400
2
+++ Makefile.in	2009-10-20 01:25:30.000000000 +0400
3
@@ -75,7 +75,7 @@
4
 srcdir = @srcdir@
5
 top_srcdir = @top_srcdir@
6
 VPATH = @srcdir@
7
-pkgdatadir = $(datadir)/@PACKAGE@
8
+pkgdatadir = $(datadir)/doc/@PACKAGE@
9
 pkglibdir = $(libdir)/@PACKAGE@
10
 pkgincludedir = $(includedir)/@PACKAGE@
11
 top_builddir = .
(-)devel/boehm-gc/files/patch-ab (-8 / +8 lines)
Lines 1-7 Link Here
1
--- doc/gc.man.orig	Mon Oct  8 10:23:01 2001
1
--- doc/gc.man.orig	2012-07-25 14:54:48.000000000 +0300
2
+++ doc/gc.man	Mon Oct  8 10:28:31 2001
2
+++ doc/gc.man	2012-07-25 14:57:40.000000000 +0300
3
@@ -9,7 +9,7 @@
3
@@ -11,7 +11,7 @@
4
 ... malloc(...) ...
4
 void * GC_realloc(void *ptr, size_t size);
5
 .br
5
 .br
6
 .sp
6
 .sp
7
-cc ... gc.a
7
-cc ... gc.a
Lines 9-19 Link Here
9
 .LP
9
 .LP
10
 .SH DESCRIPTION
10
 .SH DESCRIPTION
11
 .I GC_malloc
11
 .I GC_malloc
12
@@ -67,6 +67,48 @@
12
@@ -88,6 +88,48 @@
13
 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.
14
 .LP
13
 .LP
15
 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.
14
 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.
16
+.LP
15
 .LP
17
+.SH "PORT INFORMATION"
16
+.SH "PORT INFORMATION"
18
+.LP
17
+.LP
19
+In this (FreeBSD package) installation,
18
+In this (FreeBSD package) installation,
Lines 55-60 Link Here
55
+extension of
54
+extension of
56
+.I g++.
55
+.I g++.
57
+This may or may not make a difference.
56
+This may or may not make a difference.
58
 .LP
57
+.LP
59
 .SH "SEE ALSO"
58
 .SH "SEE ALSO"
60
 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.)
59
 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.)
60
 .LP
(-)devel/boehm-gc/files/patch-configure (-7 / +17 lines)
Lines 1-12 Link Here
1
--- configure.orig	2009-12-19 14:02:54.000000000 +0300
1
--- configure.orig	2012-07-25 14:48:53.000000000 +0300
2
+++ configure	2009-12-19 14:04:13.000000000 +0300
2
+++ configure	2012-07-25 14:53:59.000000000 +0300
3
@@ -6161,6 +6161,9 @@
3
@@ -4965,6 +4965,9 @@
4
  sparc-*-netbsd*)
4
         { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"FreeBSD does not yet fully support threads with Boehm GC.\"" >&5
5
     machdep="mach_dep.lo sparc_netbsd_mach_dep.lo"
5
 $as_echo "$as_me: WARNING: \"FreeBSD does not yet fully support threads with Boehm GC.\"" >&2;}
6
         $as_echo "#define GC_FREEBSD_THREADS 1" >>confdefs.h
7
+        if test "${enable_parallel_mark}" = yes; then
8
+          $as_echo "#define PARALLEL_MARK 1" >>confdefs.h
9
+        fi
10
 
11
         INCLUDES="$INCLUDES -pthread"
12
         ;;
13
@@ -5508,6 +5511,9 @@
14
  sparc*-*-openbsd*)
15
     machdep="mach_dep.lo sparc_mach_dep.lo"
6
     ;;
16
     ;;
7
+ sparc64-*-freebsd*)
17
+ sparc*-*-freebsd*)
8
+    machdep="mach_dep.lo sparc_mach_dep.lo"
18
+    machdep="mach_dep.lo sparc_mach_dep.lo"
9
+    ;;
19
+    ;;
10
  sparc-sun-solaris2.3)
20
  sparc-sun-solaris2.3)
11
     machdep="mach_dep.lo sparc_mach_dep.lo"
21
     machdep="mach_dep.lo sparc_mach_dep.lo"
12
     cat >>confdefs.h <<\_ACEOF
22
 
(-)devel/boehm-gc/files/patch-dbg_mlc.c (-77 lines)
Lines 1-77 Link Here
1
--- dbg_mlc.c.orig	2009-10-20 00:34:39.000000000 +0400
2
+++ dbg_mlc.c	2009-10-20 00:41:22.000000000 +0400
3
@@ -456,10 +456,34 @@
4
     GC_register_displacement((word)sizeof(oh) + offset);
5
 }
6
 
7
+#if defined(__FreeBSD__)
8
+#include <dlfcn.h>
9
+static void GC_caller_func_offset(ad, symp, offp)
10
+const GC_word ad;
11
+const char **symp;
12
+int *offp;
13
+{
14
+    Dl_info caller;
15
+    if (dladdr((const void *)ad, &caller) && caller.dli_sname != NULL) {
16
+      *symp = caller.dli_sname;
17
+      *offp = (const char *)ad - (const char *)caller.dli_saddr;
18
+    }
19
+}
20
+#else
21
+#define GC_caller_func(ad, symp, offp)
22
+#endif
23
+
24
 void * GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
25
 {
26
     void * result = GC_malloc(lb + DEBUG_BYTES);
27
-    
28
+
29
+#ifdef GC_ADD_CALLER
30
+    if (s == NULL) {
31
+      GC_caller_func_offset(ra, &s, &i);
32
+      if (s == NULL)
33
+        s = "unknown";
34
+    }
35
+#endif
36
     if (result == 0) {
37
         GC_err_printf("GC_debug_malloc(%lu) returning NIL (",
38
         	      (unsigned long) lb);
39
@@ -764,6 +788,13 @@
40
     size_t old_sz;
41
     hdr * hhdr;
42
     
43
+#ifdef GC_ADD_CALLER
44
+    if (s == NULL) {
45
+      GC_caller_func_offset(ra, &s, &i);
46
+      if (s == NULL)
47
+        s = "unknown";
48
+    }
49
+#endif
50
     if (p == 0) return(GC_debug_malloc(lb, OPT_RA s, i));
51
     if (base == 0) {
52
         GC_err_printf("Attempt to reallocate invalid pointer %p\n", p);
53
@@ -1041,17 +1072,21 @@
54
 }
55
 
56
 #ifdef GC_ADD_CALLER
57
-# define RA GC_RETURN_ADDR,
58
+# ifdef GC_RETURN_ADDR_PARENT
59
+#  define RA GC_RETURN_ADDR_PARENT,
60
+# else
61
+#  define RA GC_RETURN_ADDR,
62
+# endif
63
 #else
64
 # define RA
65
 #endif
66
 
67
 void * GC_debug_malloc_replacement(size_t lb)
68
 {
69
-    return GC_debug_malloc(lb, RA "unknown", 0);
70
+    return GC_debug_malloc(lb, RA NULL, 0);
71
 }
72
 
73
 void * GC_debug_realloc_replacement(void *p, size_t lb)
74
 {
75
-    return GC_debug_realloc(p, lb, RA "unknown", 0);
76
+    return GC_debug_realloc(p, lb, RA NULL, 0);
77
 }
(-)devel/boehm-gc/files/patch-dyn_load.c (-15 lines)
Lines 1-15 Link Here
1
--- dyn_load.c.orig	Thu May  6 08:03:06 2004
2
+++ dyn_load.c	Sun Oct 31 01:53:01 2004
3
@@ -97,6 +97,12 @@
4
 #      else
5
 #        define ElfW(type) Elf64_##type
6
 #      endif
7
+#    elif defined(__FreeBSD__)
8
+#      if __ELF_WORD_SIZE == 32
9
+#        define ElfW(type) Elf32_##type
10
+#      else
11
+#        define ElfW(type) Elf64_##type
12
+#      endif
13
 #    else
14
 #      if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32
15
 #        define ElfW(type) Elf32_##type
(-)devel/boehm-gc/files/patch-include-gc.h (-10 lines)
Lines 1-10 Link Here
1
--- include/gc.h.orig	Wed Jun  4 17:07:33 2003
2
+++ include/gc.h	Wed May 12 20:03:22 2004
3
@@ -487,6 +487,7 @@
4
     /* gcc knows how to retrieve return address, but we don't know */
5
     /* how to generate call stacks.				   */
6
 #   define GC_RETURN_ADDR (GC_word)__builtin_return_address(0)
7
+#   define GC_RETURN_ADDR_PARENT (GC_word)__builtin_return_address(1)
8
 # else
9
     /* Just pass 0 for gcc compatibility. */
10
 #   define GC_RETURN_ADDR 0
(-)devel/boehm-gc/files/patch-include-private-gcconfig.h (-44 / +30 lines)
Lines 1-42 Link Here
1
--- include/private/gcconfig.h.orig	2008-02-20 22:23:00.000000000 +0300
1
--- include/private/gcconfig.h.orig	2012-07-25 15:03:15.000000000 +0300
2
+++ include/private/gcconfig.h	2009-10-20 01:08:38.000000000 +0400
2
+++ include/private/gcconfig.h	2012-07-25 15:07:05.000000000 +0300
3
@@ -64,7 +64,7 @@
3
@@ -73,7 +73,8 @@
4
 /* Determine the machine type: */
4
 # if defined(__arm) || defined(__arm__) || defined(__thumb__)
5
 # if defined(__arm__) || defined(__thumb__)
6
 #    define ARM32
5
 #    define ARM32
7
-#    if !defined(LINUX) && !defined(NETBSD)
6
 #    if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) \
8
+#    if !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD)
7
-        && !defined(DARWIN) && !defined(_WIN32) && !defined(__CEGCC__)
8
+        && !defined(DARWIN) && !defined(_WIN32) && !defined(__CEGCC__) \
9
+        && !defined(FREEBSD)
9
 #      define NOSYS
10
 #      define NOSYS
10
 #      define mach_type_known
11
 #      define mach_type_known
11
 #    endif
12
 #    endif
12
@@ -334,10 +334,26 @@
13
@@ -359,10 +360,18 @@
13
 #    define X86_64
14
 #   define I386
14
 #    define mach_type_known
15
 #   define mach_type_known
15
 # endif
16
 # endif
16
+# if defined(__FreeBSD__) && defined(__amd64__)
17
-# if defined(FREEBSD) && defined(__x86_64__)
17
+#    define X86_64
18
+# if defined(FREEBSD) && defined(__amd64__)
18
+#    define mach_type_known
19
 #   define X86_64
19
+# endif
20
 #   define mach_type_known
20
+# if defined(__FreeBSD__) && defined(__ia64__)
21
+#    define IA64
22
+#    define mach_type_known
23
+# endif
24
 # if defined(FREEBSD) && defined(__sparc__)
25
 #    define SPARC
26
 #    define mach_type_known
27
 # endif
21
 # endif
28
+# if defined(FREEBSD) && defined(__powerpc__)
22
+# if defined(FREEBSD) && defined(__ia64__)
29
+#    define POWERPC
23
+#   define IA64
30
+#    define mach_type_known
24
+#   define mach_type_known
31
+# endif
25
+# endif
32
+# if defined(FREEBSD) && defined(__arm__)
26
+# if defined(FREEBSD) && defined(__arm__)
33
+#    define ARM32
27
+#   define ARM32
34
+#    define mach_type_known
28
+#   define mach_type_known
35
+# endif
29
+# endif
36
 # if defined(bsdi) && (defined(i386) || defined(__i386__))
30
 # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
37
 #    define I386
31
 #   define I386
38
 #    define BSDI
32
 #   define mach_type_known
39
@@ -1771,6 +1787,16 @@
33
@@ -1949,6 +1958,16 @@
40
 #     define OS_TYPE "MSWINCE"
34
 #     define OS_TYPE "MSWINCE"
41
 #     define DATAEND /* not needed */
35
 #     define DATAEND /* not needed */
42
 #   endif
36
 #   endif
Lines 46-63 Link Here
46
+#       ifdef __ELF__
40
+#       ifdef __ELF__
47
+#           define DYNAMIC_LOADING
41
+#           define DYNAMIC_LOADING
48
+#       endif
42
+#       endif
49
+#	define HEURISTIC2
43
+#      define HEURISTIC2
50
+	extern char etext[];
44
+       extern char etext[];
51
+#	define SEARCH_FOR_DATA_START
45
+#      define SEARCH_FOR_DATA_START
52
+#   endif
46
+#   endif
53
 #   ifdef NOSYS
47
 #   ifdef DARWIN
54
       /* __data_start is usually defined in the target linker script.  */
48
       /* iPhone */
55
       extern int __data_start[];
49
 #     define OS_TYPE "DARWIN"
56
@@ -1800,6 +1826,7 @@
57
 #     define OS_TYPE "MSWINCE"
58
 #     define DATAEND /* not needed */
59
 #   endif
60
+		   
61
 #   ifdef LINUX
62
 #     define OS_TYPE "LINUX"
63
 #     define LINUX_STACKBOTTOM
(-)devel/boehm-gc/files/patch-os_dep.c (-38 / +22 lines)
Lines 1-44 Link Here
1
--- os_dep.c.orig	2008-02-29 11:01:28.000000000 -0800
1
--- os_dep.c.orig	2012-07-25 15:08:26.000000000 +0300
2
+++ os_dep.c	2010-04-01 00:50:34.000000000 -0700
2
+++ os_dep.c	2012-07-25 15:16:54.000000000 +0300
3
@@ -816,7 +816,7 @@
3
@@ -843,7 +843,7 @@
4
     || defined(HURD) || defined(NETBSD)
4
     GC_INNER void GC_set_and_save_fault_handler(GC_fault_handler_t h)
5
 	static struct sigaction old_segv_act;
6
 #	if defined(_sigargs) /* !Irix6.x */ || defined(HPUX) \
7
-	|| defined(HURD) || defined(NETBSD)
8
+	|| defined(HURD) || defined(NETBSD) || defined(FREEBSD)
9
 	    static struct sigaction old_bus_act;
10
 #	endif
11
 #   else
12
@@ -826,7 +826,7 @@
13
     void GC_set_and_save_fault_handler(handler h)
14
     {
5
     {
15
 #	if defined(SUNOS5SIGS) || defined(IRIX5)  \
6
 #       if defined(SUNOS5SIGS) || defined(IRIX5) \
16
-        || defined(OSF1) || defined(HURD) || defined(NETBSD)
7
-           || defined(OSF1) || defined(HURD) || defined(NETBSD)
17
+        || defined(OSF1) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
8
+           || defined(OSF1) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
18
 	  struct sigaction	act;
9
           struct sigaction act;
19
 
10
 
20
 	  act.sa_handler	= h;
11
           act.sa_handler = h;
21
@@ -846,7 +846,7 @@
12
@@ -3072,8 +3072,15 @@
22
 #	  else
13
 #     ifndef SEGV_ACCERR
23
 	        (void) sigaction(SIGSEGV, &act, &old_segv_act);
14
 #       define SEGV_ACCERR 2
24
 #		if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
15
 #     endif
25
-		   || defined(HPUX) || defined(HURD) || defined(NETBSD)
16
-#     define CODE_OK (si -> si_code == BUS_PAGE_FAULT \
26
+		   || defined(HPUX) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
27
 		    /* Under Irix 5.x or HP/UX, we may get SIGBUS.	*/
28
 		    /* Pthreads doesn't exist under Irix 5.x, so we	*/
29
 		    /* don't have to worry in the threads case.		*/
30
@@ -2713,7 +2713,13 @@
31
 #   include <errno.h>
32
 #   if defined(FREEBSD)
33
 #     define SIG_OK TRUE
34
-#     define CODE_OK (code == BUS_PAGE_FAULT)
35
+#     if defined(POWERPC)
17
+#     if defined(POWERPC)
36
+#	define AIM	/* Pretend that we're AIM. */
18
+#      define AIM      /* Pretend that we're AIM. */
37
+#	include <machine/trap.h>
19
+#      include <machine/trap.h>
38
+#       define CODE_OK (code == EXC_DSI)
20
+#       define CODE_OK (si -> si_code == EXC_DSI \
21
+          || si -> si_code == SEGV_ACCERR)
39
+#     else
22
+#     else
40
+#       define CODE_OK (code == BUS_PAGE_FAULT)
23
+#       define CODE_OK (si -> si_code == BUS_PAGE_FAULT \
24
           || si -> si_code == SEGV_ACCERR)
41
+#     endif
25
+#     endif
42
 #   elif defined(OSF1)
26
 #   elif defined(OSF1)
43
 #     define SIG_OK (sig == SIGSEGV)
27
 #     define CODE_OK (si -> si_code == 2 /* experimentally determined */)
44
 #     define CODE_OK (code == 2 /* experimentally determined */)
28
 #   elif defined(IRIX5)
(-)devel/boehm-gc/pkg-plist (-36 / +1 lines)
Lines 1-4 Link Here
1
include/gc.h
1
include/gc.h
2
include/gc/cord.h
2
include/gc/gc.h
3
include/gc/gc.h
3
include/gc/gc_allocator.h
4
include/gc/gc_allocator.h
4
include/gc/gc_amiga_redirects.h
5
include/gc/gc_amiga_redirects.h
Lines 23-62 Link Here
23
lib/libgccpp.so
24
lib/libgccpp.so
24
lib/libgccpp.so.1
25
lib/libgccpp.so.1
25
libdata/pkgconfig/bdw-gc.pc
26
libdata/pkgconfig/bdw-gc.pc
26
share/doc/gc/README
27
share/doc/gc/README.DGUX386
28
share/doc/gc/README.Mac
29
share/doc/gc/README.MacOSX
30
share/doc/gc/README.OS2
31
share/doc/gc/README.amiga
32
share/doc/gc/README.arm.cross
33
share/doc/gc/README.autoconf
34
share/doc/gc/README.changes
35
share/doc/gc/README.contributors
36
share/doc/gc/README.cords
37
share/doc/gc/README.darwin
38
share/doc/gc/README.dj
39
share/doc/gc/README.environment
40
share/doc/gc/README.ews4800
41
share/doc/gc/README.hp
42
share/doc/gc/README.linux
43
share/doc/gc/README.macros
44
share/doc/gc/README.rs6000
45
share/doc/gc/README.sgi
46
share/doc/gc/README.solaris2
47
share/doc/gc/README.uts
48
share/doc/gc/README.win32
49
share/doc/gc/README.win64
50
share/doc/gc/barrett_diagram
51
share/doc/gc/debugging.html
52
share/doc/gc/gc.man
53
share/doc/gc/gcdescr.html
54
share/doc/gc/gcinterface.html
55
share/doc/gc/leak.html
56
share/doc/gc/overview.html
57
share/doc/gc/porting.html
58
share/doc/gc/scale.html
59
share/doc/gc/simple_example.html
60
share/doc/gc/tree.html
61
@dirrm share/doc/gc
62
@dirrm include/gc
27
@dirrm include/gc
(-)devel/boehm-gc-redirect/Makefile (-56 / +8 lines)
Lines 1-63 Link Here
1
# New ports collection makefile for:	boehm-gc-redirect
1
# Created by: stas
2
# Date created:		12/17/2009
3
# Whom:			stas
4
#
5
# $FreeBSD$
2
# $FreeBSD$
6
#
7
3
8
PORTNAME=	boehm-gc
4
PORTREVISION=	0
9
PORTVERSION=	7.1
10
CATEGORIES=	devel
11
MASTER_SITES=	http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/
12
PKGNAMESUFFIX=	-${GC_VARIANT}
13
DISTNAME=	gc-${PORTVERSION:S/.a/alpha/}
14
5
15
MAINTAINER=	ports@FreeBSD.org
6
COMMENT=	Garbage collection and memory leak detection for C and C++ with malloc redirection
16
COMMENT=	Garbage collection and memory leak detection for C and C++
17
7
18
RUN_DEPENDS=	${PREFIX}/include/gc/gc.h:${PORTSDIR}/devel/boehm-gc
8
LICENSE=	MIT
19
9
20
GNU_CONFIGURE=	yes
10
MASTERDIR=	${.CURDIR}/../boehm-gc
21
USE_LDCONFIG=	yes
11
DESCR=		${.CURDIR}/pkg-descr
22
CONFIGURE_ARGS=	--enable-cplusplus --disable-static --disable-threads \
12
23
		--enable-redirect-malloc
24
CONFIGURE_ENV=	CFLAGSS="${CFLAGS} LIBS="${LIBS}
25
MAKE_JOBS_UNSAFE=	yes
26
INSTLIBS=	cord gc gccpp
27
GC_VARIANT=	redirect
13
GC_VARIANT=	redirect
28
SOVER=	1
29
14
30
OPTIONS_DEFINE=	DEBUG
15
.include "${MASTERDIR}/Makefile"
31
32
PLIST_FILES=	${INSTLIBS:S,^,lib/lib,g:S,$,-${GC_VARIANT}.so.${SOVER},g} \
33
		${INSTLIBS:S,^,lib/lib,g:S,$,-${GC_VARIANT}.so,g}
34
35
.include <bsd.port.pre.mk>
36
37
.if ${ARCH} == "ia64"
38
BROKEN=	Does not compile on ia64
39
.endif
40
41
.if ${PORT_OPTIONS:MDEBUG}
42
CONFIGURE_ARGS+=	--enable-gc-debug
43
PKGNAMESUFFIX:=	${PKGNAMESUFFIX}+fulldebug
44
.endif
45
46
post-patch:
47
	${REINPLACE_CMD} -E -e 's,libgc\.la,libgc-${GC_VARIANT}.la,g' \
48
		-e 's,libgccpp\.la,libgccpp-${GC_VARIANT}.la,g' \
49
		-e 's,libcord\.la,libcord-${GC_VARIANT}.la,g' \
50
		${WRKSRC}/Makefile.in
51
52
do-install:
53
.for LIB in ${INSTLIBS}
54
	${INSTALL_DATA} ${WRKSRC}/.libs/lib${LIB}-${GC_VARIANT}.so.${SOVER} \
55
	    ${PREFIX}/lib/lib${LIB}-${GC_VARIANT}.so.${SOVER}
56
	@(cd ${PREFIX}/lib && ${LN} -s lib${LIB}-${GC_VARIANT}.so.${SOVER} \
57
	    lib${LIB}-${GC_VARIANT}.so)
58
.endfor
59
60
test: build
61
	cd ${WRKSRC} && ${MAKE} check
62
63
.include <bsd.port.post.mk>
(-)devel/boehm-gc-redirect/distinfo (-2 lines)
Lines 1-2 Link Here
1
SHA256 (gc-7.1.tar.gz) = e3cef6028fe3efe7de3bcf4107c880eae50b3ee79841450d885467c09bcebf30
2
SIZE (gc-7.1.tar.gz) = 1077714
(-)devel/boehm-gc-redirect/files/patch-configure (-12 lines)
Lines 1-12 Link Here
1
--- configure.orig	2009-12-19 14:02:54.000000000 +0300
2
+++ configure	2009-12-19 14:04:13.000000000 +0300
3
@@ -6161,6 +6161,9 @@
4
  sparc-*-netbsd*)
5
     machdep="mach_dep.lo sparc_netbsd_mach_dep.lo"
6
     ;;
7
+ sparc64-*-freebsd*)
8
+    machdep="mach_dep.lo sparc_mach_dep.lo"
9
+    ;;
10
  sparc-sun-solaris2.3)
11
     machdep="mach_dep.lo sparc_mach_dep.lo"
12
     cat >>confdefs.h <<\_ACEOF
(-)devel/boehm-gc-redirect/files/patch-dbg_mlc.c (-77 lines)
Lines 1-77 Link Here
1
--- dbg_mlc.c.orig	2009-10-20 00:34:39.000000000 +0400
2
+++ dbg_mlc.c	2009-10-20 00:41:22.000000000 +0400
3
@@ -456,10 +456,34 @@
4
     GC_register_displacement((word)sizeof(oh) + offset);
5
 }
6
 
7
+#if defined(__FreeBSD__)
8
+#include <dlfcn.h>
9
+static void GC_caller_func_offset(ad, symp, offp)
10
+const GC_word ad;
11
+const char **symp;
12
+int *offp;
13
+{
14
+    Dl_info caller;
15
+    if (dladdr((const void *)ad, &caller) && caller.dli_sname != NULL) {
16
+      *symp = caller.dli_sname;
17
+      *offp = (const char *)ad - (const char *)caller.dli_saddr;
18
+    }
19
+}
20
+#else
21
+#define GC_caller_func(ad, symp, offp)
22
+#endif
23
+
24
 void * GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
25
 {
26
     void * result = GC_malloc(lb + DEBUG_BYTES);
27
-    
28
+
29
+#ifdef GC_ADD_CALLER
30
+    if (s == NULL) {
31
+      GC_caller_func_offset(ra, &s, &i);
32
+      if (s == NULL)
33
+        s = "unknown";
34
+    }
35
+#endif
36
     if (result == 0) {
37
         GC_err_printf("GC_debug_malloc(%lu) returning NIL (",
38
         	      (unsigned long) lb);
39
@@ -764,6 +788,13 @@
40
     size_t old_sz;
41
     hdr * hhdr;
42
     
43
+#ifdef GC_ADD_CALLER
44
+    if (s == NULL) {
45
+      GC_caller_func_offset(ra, &s, &i);
46
+      if (s == NULL)
47
+        s = "unknown";
48
+    }
49
+#endif
50
     if (p == 0) return(GC_debug_malloc(lb, OPT_RA s, i));
51
     if (base == 0) {
52
         GC_err_printf("Attempt to reallocate invalid pointer %p\n", p);
53
@@ -1041,17 +1072,21 @@
54
 }
55
 
56
 #ifdef GC_ADD_CALLER
57
-# define RA GC_RETURN_ADDR,
58
+# ifdef GC_RETURN_ADDR_PARENT
59
+#  define RA GC_RETURN_ADDR_PARENT,
60
+# else
61
+#  define RA GC_RETURN_ADDR,
62
+# endif
63
 #else
64
 # define RA
65
 #endif
66
 
67
 void * GC_debug_malloc_replacement(size_t lb)
68
 {
69
-    return GC_debug_malloc(lb, RA "unknown", 0);
70
+    return GC_debug_malloc(lb, RA NULL, 0);
71
 }
72
 
73
 void * GC_debug_realloc_replacement(void *p, size_t lb)
74
 {
75
-    return GC_debug_realloc(p, lb, RA "unknown", 0);
76
+    return GC_debug_realloc(p, lb, RA NULL, 0);
77
 }
(-)devel/boehm-gc-redirect/files/patch-dyn_load.c (-15 lines)
Lines 1-15 Link Here
1
--- dyn_load.c.orig	Thu May  6 08:03:06 2004
2
+++ dyn_load.c	Sun Oct 31 01:53:01 2004
3
@@ -97,6 +97,12 @@
4
 #      else
5
 #        define ElfW(type) Elf64_##type
6
 #      endif
7
+#    elif defined(__FreeBSD__)
8
+#      if __ELF_WORD_SIZE == 32
9
+#        define ElfW(type) Elf32_##type
10
+#      else
11
+#        define ElfW(type) Elf64_##type
12
+#      endif
13
 #    else
14
 #      if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32
15
 #        define ElfW(type) Elf32_##type
(-)devel/boehm-gc-redirect/files/patch-include-gc.h (-10 lines)
Lines 1-10 Link Here
1
--- include/gc.h.orig	Wed Jun  4 17:07:33 2003
2
+++ include/gc.h	Wed May 12 20:03:22 2004
3
@@ -487,6 +487,7 @@
4
     /* gcc knows how to retrieve return address, but we don't know */
5
     /* how to generate call stacks.				   */
6
 #   define GC_RETURN_ADDR (GC_word)__builtin_return_address(0)
7
+#   define GC_RETURN_ADDR_PARENT (GC_word)__builtin_return_address(1)
8
 # else
9
     /* Just pass 0 for gcc compatibility. */
10
 #   define GC_RETURN_ADDR 0
(-)devel/boehm-gc-redirect/files/patch-include-private-gcconfig.h (-63 lines)
Lines 1-63 Link Here
1
--- include/private/gcconfig.h.orig	2008-02-20 22:23:00.000000000 +0300
2
+++ include/private/gcconfig.h	2009-10-20 01:08:38.000000000 +0400
3
@@ -64,7 +64,7 @@
4
 /* Determine the machine type: */
5
 # if defined(__arm__) || defined(__thumb__)
6
 #    define ARM32
7
-#    if !defined(LINUX) && !defined(NETBSD)
8
+#    if !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD)
9
 #      define NOSYS
10
 #      define mach_type_known
11
 #    endif
12
@@ -334,10 +334,26 @@
13
 #    define X86_64
14
 #    define mach_type_known
15
 # endif
16
+# if defined(__FreeBSD__) && defined(__amd64__)
17
+#    define X86_64
18
+#    define mach_type_known
19
+# endif
20
+# if defined(__FreeBSD__) && defined(__ia64__)
21
+#    define IA64
22
+#    define mach_type_known
23
+# endif
24
 # if defined(FREEBSD) && defined(__sparc__)
25
 #    define SPARC
26
 #    define mach_type_known
27
 # endif
28
+# if defined(FREEBSD) && defined(__powerpc__)
29
+#    define POWERPC
30
+#    define mach_type_known
31
+# endif
32
+# if defined(FREEBSD) && defined(__arm__)
33
+#    define ARM32
34
+#    define mach_type_known
35
+# endif
36
 # if defined(bsdi) && (defined(i386) || defined(__i386__))
37
 #    define I386
38
 #    define BSDI
39
@@ -1771,6 +1787,16 @@
40
 #     define OS_TYPE "MSWINCE"
41
 #     define DATAEND /* not needed */
42
 #   endif
43
+#   ifdef FREEBSD
44
+#   define ALIGNMENT 4
45
+#       define OS_TYPE "FREEBSD"
46
+#       ifdef __ELF__
47
+#           define DYNAMIC_LOADING
48
+#       endif
49
+#	define HEURISTIC2
50
+	extern char etext[];
51
+#	define SEARCH_FOR_DATA_START
52
+#   endif
53
 #   ifdef NOSYS
54
       /* __data_start is usually defined in the target linker script.  */
55
       extern int __data_start[];
56
@@ -1800,6 +1826,7 @@
57
 #     define OS_TYPE "MSWINCE"
58
 #     define DATAEND /* not needed */
59
 #   endif
60
+		   
61
 #   ifdef LINUX
62
 #     define OS_TYPE "LINUX"
63
 #     define LINUX_STACKBOTTOM
(-)devel/boehm-gc-redirect/files/patch-os_dep.c (-44 lines)
Lines 1-44 Link Here
1
--- os_dep.c.orig	2008-02-29 11:01:28.000000000 -0800
2
+++ os_dep.c	2010-04-01 00:50:34.000000000 -0700
3
@@ -816,7 +816,7 @@
4
     || defined(HURD) || defined(NETBSD)
5
 	static struct sigaction old_segv_act;
6
 #	if defined(_sigargs) /* !Irix6.x */ || defined(HPUX) \
7
-	|| defined(HURD) || defined(NETBSD)
8
+	|| defined(HURD) || defined(NETBSD) || defined(FREEBSD)
9
 	    static struct sigaction old_bus_act;
10
 #	endif
11
 #   else
12
@@ -826,7 +826,7 @@
13
     void GC_set_and_save_fault_handler(handler h)
14
     {
15
 #	if defined(SUNOS5SIGS) || defined(IRIX5)  \
16
-        || defined(OSF1) || defined(HURD) || defined(NETBSD)
17
+        || defined(OSF1) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
18
 	  struct sigaction	act;
19
 
20
 	  act.sa_handler	= h;
21
@@ -846,7 +846,7 @@
22
 #	  else
23
 	        (void) sigaction(SIGSEGV, &act, &old_segv_act);
24
 #		if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
25
-		   || defined(HPUX) || defined(HURD) || defined(NETBSD)
26
+		   || defined(HPUX) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
27
 		    /* Under Irix 5.x or HP/UX, we may get SIGBUS.	*/
28
 		    /* Pthreads doesn't exist under Irix 5.x, so we	*/
29
 		    /* don't have to worry in the threads case.		*/
30
@@ -2713,7 +2713,13 @@
31
 #   include <errno.h>
32
 #   if defined(FREEBSD)
33
 #     define SIG_OK TRUE
34
-#     define CODE_OK (code == BUS_PAGE_FAULT)
35
+#     if defined(POWERPC)
36
+#	define AIM	/* Pretend that we're AIM. */
37
+#	include <machine/trap.h>
38
+#       define CODE_OK (code == EXC_DSI)
39
+#     else
40
+#       define CODE_OK (code == BUS_PAGE_FAULT)
41
+#     endif
42
 #   elif defined(OSF1)
43
 #     define SIG_OK (sig == SIGSEGV)
44
 #     define CODE_OK (code == 2 /* experimentally determined */)
(-)devel/boehm-gc-threaded/Makefile (-66 / +8 lines)
Lines 1-73 Link Here
1
# New ports collection makefile for:	boehm-gc-redirect
1
# Created by: stas
2
# Date created:		12/17/2009
3
# Whom:			stas
4
#
5
# $FreeBSD$
2
# $FreeBSD$
6
#
7
3
8
PORTNAME=	boehm-gc
4
PORTREVISION=	0
9
PORTVERSION=	7.1
10
PORTREVISION=	1
11
CATEGORIES=	devel
12
MASTER_SITES=	http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/
13
PKGNAMESUFFIX=	-${GC_VARIANT}
14
DISTNAME=	gc-${PORTVERSION:S/.a/alpha/}
15
5
16
MAINTAINER=	ports@FreeBSD.org
6
COMMENT=	Garbage collection and memory leak detection for C and C++ with threading support
17
COMMENT=	Garbage collection and memory leak detection for C and C++
18
7
19
RUN_DEPENDS=	${PREFIX}/include/gc/gc.h:${PORTSDIR}/devel/boehm-gc
8
LICENSE=	MIT
20
9
21
GNU_CONFIGURE=	yes
10
MASTERDIR=	${.CURDIR}/../boehm-gc
22
USE_LDCONFIG=	yes
11
DESCR=		${.CURDIR}/pkg-descr
23
CONFIGURE_ARGS=	--enable-cplusplus --disable-static --enable-threads=posix \
12
24
		--enable-thread-local-alloc
25
CONFIGURE_ENV=	CFLAGSS="${CFLAGS} LIBS="${LIBS}
26
MAKE_JOBS_UNSAFE=	yes
27
INSTLIBS=	cord gc gccpp
28
GC_VARIANT=	threaded
13
GC_VARIANT=	threaded
29
SOVER=	1
30
14
31
OPTIONS_DEFINE=	PARALLEL_MARK DEBUG
15
.include "${MASTERDIR}/Makefile"
32
PARALLEL_MARK_DESC=	Parallel-thread marking (faster for SMP)
33
34
PLIST_FILES=	${INSTLIBS:S,^,lib/lib,g:S,$,-${GC_VARIANT}.so.${SOVER},g} \
35
		${INSTLIBS:S,^,lib/lib,g:S,$,-${GC_VARIANT}.so,g} \
36
		libdata/pkgconfig/bdw-gc-${GC_VARIANT}.pc
37
38
.include <bsd.port.pre.mk>
39
40
.if ${ARCH} == "ia64"
41
BROKEN=	Does not compile on ia64
42
.endif
43
44
.if ${PORT_OPTIONS:MPARALLEL_MARK}
45
CONFIGURE_ARGS+=	--enable-parallel-mark
46
.endif
47
48
.if ${PORT_OPTIONS:MDEBUG}
49
CONFIGURE_ARGS+=	--enable-gc-debug
50
PKGNAMESUFFIX:=	${PKGNAMESUFFIX}+fulldebug
51
.endif
52
53
post-patch:
54
	${REINPLACE_CMD} -E -e 's,libgc\.la,libgc-${GC_VARIANT}.la,g' \
55
		-e 's,libgccpp\.la,libgccpp-${GC_VARIANT}.la,g' \
56
		-e 's,libcord\.la,libcord-${GC_VARIANT}.la,g' \
57
		${WRKSRC}/Makefile.in
58
	${REINPLACE_CMD} -e 's,-lgc,-lgc-${GC_VARIANT},' ${WRKSRC}/bdw-gc.pc.in
59
60
do-install:
61
.for LIB in ${INSTLIBS}
62
	${INSTALL_DATA} ${WRKSRC}/.libs/lib${LIB}-${GC_VARIANT}.so.${SOVER} \
63
	    ${PREFIX}/lib/lib${LIB}-${GC_VARIANT}.so.${SOVER}
64
	@(cd ${PREFIX}/lib && ${LN} -s lib${LIB}-${GC_VARIANT}.so.${SOVER} \
65
	    lib${LIB}-${GC_VARIANT}.so)
66
.endfor
67
	${INSTALL_DATA} ${WRKSRC}/bdw-gc.pc \
68
		${PREFIX}/libdata/pkgconfig/bdw-gc-${GC_VARIANT}.pc
69
70
test: build
71
	cd ${WRKSRC} && ${MAKE} check
72
73
.include <bsd.port.post.mk>
(-)devel/boehm-gc-threaded/distinfo (-2 lines)
Lines 1-2 Link Here
1
SHA256 (gc-7.1.tar.gz) = e3cef6028fe3efe7de3bcf4107c880eae50b3ee79841450d885467c09bcebf30
2
SIZE (gc-7.1.tar.gz) = 1077714
(-)devel/boehm-gc-threaded/files/patch-configure (-12 lines)
Lines 1-12 Link Here
1
--- configure.orig	2009-12-19 14:02:54.000000000 +0300
2
+++ configure	2009-12-19 14:04:13.000000000 +0300
3
@@ -6161,6 +6161,9 @@
4
  sparc-*-netbsd*)
5
     machdep="mach_dep.lo sparc_netbsd_mach_dep.lo"
6
     ;;
7
+ sparc64-*-freebsd*)
8
+    machdep="mach_dep.lo sparc_mach_dep.lo"
9
+    ;;
10
  sparc-sun-solaris2.3)
11
     machdep="mach_dep.lo sparc_mach_dep.lo"
12
     cat >>confdefs.h <<\_ACEOF
(-)devel/boehm-gc-threaded/files/patch-dbg_mlc.c (-77 lines)
Lines 1-77 Link Here
1
--- dbg_mlc.c.orig	2009-10-20 00:34:39.000000000 +0400
2
+++ dbg_mlc.c	2009-10-20 00:41:22.000000000 +0400
3
@@ -456,10 +456,34 @@
4
     GC_register_displacement((word)sizeof(oh) + offset);
5
 }
6
 
7
+#if defined(__FreeBSD__)
8
+#include <dlfcn.h>
9
+static void GC_caller_func_offset(ad, symp, offp)
10
+const GC_word ad;
11
+const char **symp;
12
+int *offp;
13
+{
14
+    Dl_info caller;
15
+    if (dladdr((const void *)ad, &caller) && caller.dli_sname != NULL) {
16
+      *symp = caller.dli_sname;
17
+      *offp = (const char *)ad - (const char *)caller.dli_saddr;
18
+    }
19
+}
20
+#else
21
+#define GC_caller_func(ad, symp, offp)
22
+#endif
23
+
24
 void * GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
25
 {
26
     void * result = GC_malloc(lb + DEBUG_BYTES);
27
-    
28
+
29
+#ifdef GC_ADD_CALLER
30
+    if (s == NULL) {
31
+      GC_caller_func_offset(ra, &s, &i);
32
+      if (s == NULL)
33
+        s = "unknown";
34
+    }
35
+#endif
36
     if (result == 0) {
37
         GC_err_printf("GC_debug_malloc(%lu) returning NIL (",
38
         	      (unsigned long) lb);
39
@@ -764,6 +788,13 @@
40
     size_t old_sz;
41
     hdr * hhdr;
42
     
43
+#ifdef GC_ADD_CALLER
44
+    if (s == NULL) {
45
+      GC_caller_func_offset(ra, &s, &i);
46
+      if (s == NULL)
47
+        s = "unknown";
48
+    }
49
+#endif
50
     if (p == 0) return(GC_debug_malloc(lb, OPT_RA s, i));
51
     if (base == 0) {
52
         GC_err_printf("Attempt to reallocate invalid pointer %p\n", p);
53
@@ -1041,17 +1072,21 @@
54
 }
55
 
56
 #ifdef GC_ADD_CALLER
57
-# define RA GC_RETURN_ADDR,
58
+# ifdef GC_RETURN_ADDR_PARENT
59
+#  define RA GC_RETURN_ADDR_PARENT,
60
+# else
61
+#  define RA GC_RETURN_ADDR,
62
+# endif
63
 #else
64
 # define RA
65
 #endif
66
 
67
 void * GC_debug_malloc_replacement(size_t lb)
68
 {
69
-    return GC_debug_malloc(lb, RA "unknown", 0);
70
+    return GC_debug_malloc(lb, RA NULL, 0);
71
 }
72
 
73
 void * GC_debug_realloc_replacement(void *p, size_t lb)
74
 {
75
-    return GC_debug_realloc(p, lb, RA "unknown", 0);
76
+    return GC_debug_realloc(p, lb, RA NULL, 0);
77
 }
(-)devel/boehm-gc-threaded/files/patch-dyn_load.c (-15 lines)
Lines 1-15 Link Here
1
--- dyn_load.c.orig	Thu May  6 08:03:06 2004
2
+++ dyn_load.c	Sun Oct 31 01:53:01 2004
3
@@ -97,6 +97,12 @@
4
 #      else
5
 #        define ElfW(type) Elf64_##type
6
 #      endif
7
+#    elif defined(__FreeBSD__)
8
+#      if __ELF_WORD_SIZE == 32
9
+#        define ElfW(type) Elf32_##type
10
+#      else
11
+#        define ElfW(type) Elf64_##type
12
+#      endif
13
 #    else
14
 #      if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32
15
 #        define ElfW(type) Elf32_##type
(-)devel/boehm-gc-threaded/files/patch-include-gc.h (-10 lines)
Lines 1-10 Link Here
1
--- include/gc.h.orig	Wed Jun  4 17:07:33 2003
2
+++ include/gc.h	Wed May 12 20:03:22 2004
3
@@ -487,6 +487,7 @@
4
     /* gcc knows how to retrieve return address, but we don't know */
5
     /* how to generate call stacks.				   */
6
 #   define GC_RETURN_ADDR (GC_word)__builtin_return_address(0)
7
+#   define GC_RETURN_ADDR_PARENT (GC_word)__builtin_return_address(1)
8
 # else
9
     /* Just pass 0 for gcc compatibility. */
10
 #   define GC_RETURN_ADDR 0
(-)devel/boehm-gc-threaded/files/patch-include-private-gcconfig.h (-63 lines)
Lines 1-63 Link Here
1
--- include/private/gcconfig.h.orig	2008-02-20 22:23:00.000000000 +0300
2
+++ include/private/gcconfig.h	2009-10-20 01:08:38.000000000 +0400
3
@@ -64,7 +64,7 @@
4
 /* Determine the machine type: */
5
 # if defined(__arm__) || defined(__thumb__)
6
 #    define ARM32
7
-#    if !defined(LINUX) && !defined(NETBSD)
8
+#    if !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD)
9
 #      define NOSYS
10
 #      define mach_type_known
11
 #    endif
12
@@ -334,10 +334,26 @@
13
 #    define X86_64
14
 #    define mach_type_known
15
 # endif
16
+# if defined(__FreeBSD__) && defined(__amd64__)
17
+#    define X86_64
18
+#    define mach_type_known
19
+# endif
20
+# if defined(__FreeBSD__) && defined(__ia64__)
21
+#    define IA64
22
+#    define mach_type_known
23
+# endif
24
 # if defined(FREEBSD) && defined(__sparc__)
25
 #    define SPARC
26
 #    define mach_type_known
27
 # endif
28
+# if defined(FREEBSD) && defined(__powerpc__)
29
+#    define POWERPC
30
+#    define mach_type_known
31
+# endif
32
+# if defined(FREEBSD) && defined(__arm__)
33
+#    define ARM32
34
+#    define mach_type_known
35
+# endif
36
 # if defined(bsdi) && (defined(i386) || defined(__i386__))
37
 #    define I386
38
 #    define BSDI
39
@@ -1771,6 +1787,16 @@
40
 #     define OS_TYPE "MSWINCE"
41
 #     define DATAEND /* not needed */
42
 #   endif
43
+#   ifdef FREEBSD
44
+#   define ALIGNMENT 4
45
+#       define OS_TYPE "FREEBSD"
46
+#       ifdef __ELF__
47
+#           define DYNAMIC_LOADING
48
+#       endif
49
+#	define HEURISTIC2
50
+	extern char etext[];
51
+#	define SEARCH_FOR_DATA_START
52
+#   endif
53
 #   ifdef NOSYS
54
       /* __data_start is usually defined in the target linker script.  */
55
       extern int __data_start[];
56
@@ -1800,6 +1826,7 @@
57
 #     define OS_TYPE "MSWINCE"
58
 #     define DATAEND /* not needed */
59
 #   endif
60
+		   
61
 #   ifdef LINUX
62
 #     define OS_TYPE "LINUX"
63
 #     define LINUX_STACKBOTTOM
(-)devel/boehm-gc-threaded/files/patch-os_dep.c (-44 lines)
Lines 1-44 Link Here
1
--- os_dep.c.orig	2008-02-29 11:01:28.000000000 -0800
2
+++ os_dep.c	2010-04-01 00:50:34.000000000 -0700
3
@@ -816,7 +816,7 @@
4
     || defined(HURD) || defined(NETBSD)
5
 	static struct sigaction old_segv_act;
6
 #	if defined(_sigargs) /* !Irix6.x */ || defined(HPUX) \
7
-	|| defined(HURD) || defined(NETBSD)
8
+	|| defined(HURD) || defined(NETBSD) || defined(FREEBSD)
9
 	    static struct sigaction old_bus_act;
10
 #	endif
11
 #   else
12
@@ -826,7 +826,7 @@
13
     void GC_set_and_save_fault_handler(handler h)
14
     {
15
 #	if defined(SUNOS5SIGS) || defined(IRIX5)  \
16
-        || defined(OSF1) || defined(HURD) || defined(NETBSD)
17
+        || defined(OSF1) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
18
 	  struct sigaction	act;
19
 
20
 	  act.sa_handler	= h;
21
@@ -846,7 +846,7 @@
22
 #	  else
23
 	        (void) sigaction(SIGSEGV, &act, &old_segv_act);
24
 #		if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
25
-		   || defined(HPUX) || defined(HURD) || defined(NETBSD)
26
+		   || defined(HPUX) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
27
 		    /* Under Irix 5.x or HP/UX, we may get SIGBUS.	*/
28
 		    /* Pthreads doesn't exist under Irix 5.x, so we	*/
29
 		    /* don't have to worry in the threads case.		*/
30
@@ -2713,7 +2713,13 @@
31
 #   include <errno.h>
32
 #   if defined(FREEBSD)
33
 #     define SIG_OK TRUE
34
-#     define CODE_OK (code == BUS_PAGE_FAULT)
35
+#     if defined(POWERPC)
36
+#	define AIM	/* Pretend that we're AIM. */
37
+#	include <machine/trap.h>
38
+#       define CODE_OK (code == EXC_DSI)
39
+#     else
40
+#       define CODE_OK (code == BUS_PAGE_FAULT)
41
+#     endif
42
 #   elif defined(OSF1)
43
 #     define SIG_OK (sig == SIGSEGV)
44
 #     define CODE_OK (code == 2 /* experimentally determined */)

Return to bug 176716