ports/97021: [patch] lang/gauche: importing devel/boehm-gc patches

Hirohisa Yamaguchi umq at ueo.co.jp
Tue May 9 07:10:41 UTC 2006


>Number:         97021
>Category:       ports
>Synopsis:       [patch] lang/gauche: importing devel/boehm-gc patches
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 09 07:10:13 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Hirohisa Yamaguchi
>Release:        FreeBSD 7.0-CURRENT amd64
>Organization:
<organization of PR author (multiple lines)>
>Environment:
System: FreeBSD calliope.kaumoge.org 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Thu Jan 26 11:28:00 JST 2006 root at calliope.kaumoge.org:/usr/obj/usr/src/sys/CALLIOPE64 amd64

>Description:
	lang/gauche port on amd64 is marked as BROKEN
	because of included boehm-gc's complaint.

	I applied patches in devel/boehm-gc, and this seems to work.
	and may be okay in other ARCH's.
>How-To-Repeat:
	on ARCH's other than i386 || alpha
	# cd ports/lang/gauche
	# make 
>Fix:

	My patch follows.
	In this patch, I made least change in the Makefile:
	bumping PORTREVISION &c. might be considered.

diff -Npru ports.orig/lang/gauche/Makefile ports/lang/gauche/Makefile
--- ports.orig/lang/gauche/Makefile	Tue May  2 03:22:26 2006
+++ ports/lang/gauche/Makefile	Tue May  9 12:36:22 2006
@@ -44,7 +44,7 @@ INFO=		gauche-refe gauche-refj
 
 .include <bsd.port.pre.mk>
 
-.if ${ARCH} != "i386" && ${ARCH} != "alpha"
+.if ${ARCH} != "i386" && ${ARCH} != "alpha" && ${ARCH} != "amd64"
 BROKEN=		"Does not compile on !i386 and !alpha (due to included boehm-gc)"
 .endif
 
diff -Npru ports.orig/lang/gauche/files/patch-doc-Makefile.in ports/lang/gauche/files/patch-doc-Makefile.in
--- ports.orig/lang/gauche/files/patch-doc-Makefile.in	Mon Jan 19 18:49:24 2004
+++ ports/lang/gauche/files/patch-doc-Makefile.in	Tue May  9 14:40:13 2006
@@ -1,6 +1,6 @@
---- doc/Makefile.in.orig	Tue Jul 22 15:34:31 2003
-+++ doc/Makefile.in	Mon Oct 27 15:58:31 2003
-@@ -74,7 +74,7 @@
+--- ./doc/Makefile.in.orig	Fri Apr  7 20:26:08 2006
++++ ./doc/Makefile.in	Tue May  9 14:38:56 2006
+@@ -79,7 +79,7 @@
  
  pdf : gauche-refe.pdf
  
@@ -8,8 +8,8 @@
 +info : gauche-refe.info gauche-refj.info
  
  gauche-refe.html : gauche-refe.texi
- 	texi2html -number gauche-refe.texi
-@@ -91,11 +91,9 @@
+ 	texi2html --number gauche-refe.texi
+@@ -96,11 +96,9 @@
  gauche-refe.texi : $(TEXIS) extract
  	$(GOSH) ./extract -en -o gauche-refe.texi gauche-ref.texi
  
@@ -24,7 +24,7 @@
  	fi
  
  gauche-refj.html : gauche-refj.texi
-@@ -117,11 +115,9 @@
+@@ -121,11 +119,9 @@
  gauche-refj.texi : $(TEXIS) extract
  	$(GOSH) ./extract -jp -o gauche-refj.texi gauche-ref.texi
  
@@ -38,4 +38,4 @@
 +	  $(MAKEINFO) --no-warn --no-split gauche-refj.texi; \
  	fi
  
- libgauche-refe.texi : libgauche-ref.texi extract
+ gauche-deve.texi : gauche-dev.texi extract
diff -Npru ports.orig/lang/gauche/files/patch-gc__dbg_mlc.c ports/lang/gauche/files/patch-gc__dbg_mlc.c
--- ports.orig/lang/gauche/files/patch-gc__dbg_mlc.c	Thu Jan  1 09:00:00 1970
+++ ports/lang/gauche/files/patch-gc__dbg_mlc.c	Tue May  9 14:40:14 2006
@@ -0,0 +1,82 @@
+--- ./gc/dbg_mlc.c.orig	Sat Mar  4 12:55:43 2006
++++ ./gc/dbg_mlc.c	Tue May  9 14:38:56 2006
+@@ -477,6 +477,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
+@@ -491,6 +508,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);
+@@ -880,6 +904,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(
+@@ -1188,7 +1219,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
+@@ -1196,12 +1231,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 -Npru ports.orig/lang/gauche/files/patch-gc__doc__Makefile.in ports/lang/gauche/files/patch-gc__doc__Makefile.in
--- ports.orig/lang/gauche/files/patch-gc__doc__Makefile.in	Thu Jan  1 09:00:00 1970
+++ ports/lang/gauche/files/patch-gc__doc__Makefile.in	Tue May  9 14:40:13 2006
@@ -0,0 +1,11 @@
+--- ./gc/doc/Makefile.in.orig	Sat Mar  4 12:55:44 2006
++++ ./gc/doc/Makefile.in	Tue May  9 14:38:56 2006
+@@ -30,7 +30,7 @@
+ srcdir = @srcdir@
+ top_srcdir = @top_srcdir@
+ VPATH = @srcdir@
+-pkgdatadir = $(datadir)/@PACKAGE@
++pkgdatadir = $(datadir)/doc/@PACKAGE@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkgincludedir = $(includedir)/@PACKAGE@
+ top_builddir = ..
diff -Npru ports.orig/lang/gauche/files/patch-gc__doc__gc.man ports/lang/gauche/files/patch-gc__doc__gc.man
--- ports.orig/lang/gauche/files/patch-gc__doc__gc.man	Thu Jan  1 09:00:00 1970
+++ ports/lang/gauche/files/patch-gc__doc__gc.man	Tue May  9 14:40:14 2006
@@ -0,0 +1,60 @@
+--- ./gc/doc/gc.man.orig	Tue Sep 14 17:40:06 2004
++++ ./gc/doc/gc.man	Tue May  9 14:38:56 2006
+@@ -11,7 +11,7 @@
+ void * GC_realloc(void *ptr, size_t size);
+ .br
+ .sp
+-cc ... gc.a
++cc ... -lgc
+ .LP
+ .SH DESCRIPTION
+ .I GC_malloc
+@@ -81,6 +81,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 (FreeBSD package) installation,
++.I gc.h
++and
++.I gc_cpp.h
++will probably be found in
++.I %%PREFIX%%/include,
++and the library in
++.I %%PREFIX%%/lib.
++.LP
++This library has 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
++This library is 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.)
diff -Npru ports.orig/lang/gauche/files/patch-gc__dyn_load.c ports/lang/gauche/files/patch-gc__dyn_load.c
--- ports.orig/lang/gauche/files/patch-gc__dyn_load.c	Thu Jan  1 09:00:00 1970
+++ ports/lang/gauche/files/patch-gc__dyn_load.c	Tue May  9 14:40:14 2006
@@ -0,0 +1,15 @@
+--- ./gc/dyn_load.c.orig	Sat Mar  4 12:55:43 2006
++++ ./gc/dyn_load.c	Tue May  9 14:38:56 2006
+@@ -102,6 +102,12 @@
+ #      else
+ #        define ElfW(type) Elf64_##type
+ #      endif
++#    elif defined(__FreeBSD__)
++#      if __ELF_WORD_SIZE == 32
++#        define ElfW(type) Elf32_##type
++#      else
++#        define ElfW(type) Elf64_##type
++#      endif
+ #    else
+ #      ifdef NETBSD
+ #        if ELFSIZE == 32
diff -Npru ports.orig/lang/gauche/files/patch-gc__include__gc.h ports/lang/gauche/files/patch-gc__include__gc.h
--- ports.orig/lang/gauche/files/patch-gc__include__gc.h	Thu Jan  1 09:00:00 1970
+++ ports/lang/gauche/files/patch-gc__include__gc.h	Tue May  9 14:40:14 2006
@@ -0,0 +1,10 @@
+--- ./gc/include/gc.h.orig	Sat Mar  4 12:55:44 2006
++++ ./gc/include/gc.h	Tue May  9 14:38:56 2006
+@@ -504,6 +504,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
diff -Npru ports.orig/lang/gauche/files/patch-gc__include__gc_cpp.h ports/lang/gauche/files/patch-gc__include__gc_cpp.h
--- ports.orig/lang/gauche/files/patch-gc__include__gc_cpp.h	Thu Jan  1 09:00:00 1970
+++ ports/lang/gauche/files/patch-gc__include__gc_cpp.h	Tue May  9 14:40:14 2006
@@ -0,0 +1,20 @@
+--- ./gc/include/gc_cpp.h.orig	Sat Mar  4 12:55:44 2006
++++ ./gc/include/gc_cpp.h	Tue May  9 14:38:56 2006
+@@ -281,7 +281,7 @@
+     else
+         return GC_MALLOC_UNCOLLECTABLE( size );}
+ 
+-inline void* gc::operator new( size_t size, void *p ) {
++inline void* gc::operator new( size_t, void *p ) {
+     return p;}
+ 
+ inline void gc::operator delete( void* obj ) {
+@@ -299,7 +299,7 @@
+ inline void* gc::operator new[]( size_t size, GCPlacement gcp ) {
+     return gc::operator new( size, gcp );}
+ 
+-inline void* gc::operator new[]( size_t size, void *p ) {
++inline void* gc::operator new[]( size_t, void *p ) {
+     return p;}
+ 
+ inline void gc::operator delete[]( void* obj ) {
diff -Npru ports.orig/lang/gauche/files/patch-gc__include__private__gcconfig.h ports/lang/gauche/files/patch-gc__include__private__gcconfig.h
--- ports.orig/lang/gauche/files/patch-gc__include__private__gcconfig.h	Thu Jan  1 09:00:00 1970
+++ ports/lang/gauche/files/patch-gc__include__private__gcconfig.h	Tue May  9 14:40:14 2006
@@ -0,0 +1,88 @@
+--- ./gc/include/private/gcconfig.h.orig	Sat Mar  4 12:55:44 2006
++++ ./gc/include/private/gcconfig.h	Tue May  9 14:38:56 2006
+@@ -62,7 +62,7 @@
+ /* Determine the machine type: */
+ # if defined(__arm__) || defined(__thumb__)
+ #    define ARM32
+-#    if !defined(LINUX) && !defined(NETBSD)
++#    if !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD)
+ #      define NOSYS
+ #      define mach_type_known
+ #    endif
+@@ -335,10 +335,22 @@
+ #    define X86_64
+ #    define mach_type_known
+ # endif
++# if defined(__FreeBSD__) && defined(__amd64__)
++#    define X86_64
++#    define mach_type_known
++# endif
+ # if defined(FREEBSD) && defined(__sparc__)
+ #    define SPARC
+ #    define mach_type_known
+-#endif
++# endif
++# if defined(FREEBSD) && defined(__powerpc__)
++#    define POWERPC
++#    define mach_type_known
++# endif
++# if defined(FREEBSD) && defined(__arm__)
++#    define ARM32
++#    define mach_type_known
++# endif
+ # if defined(bsdi) && (defined(i386) || defined(__i386__))
+ #    define I386
+ #    define BSDI
+@@ -853,6 +865,16 @@
+ #     define DATASTART GC_data_start
+ #     define DYNAMIC_LOADING
+ #   endif
++#   ifdef FREEBSD
++#   define ALIGNMENT 4
++#       define OS_TYPE "FREEBSD"
++#       ifdef __ELF__
++#           define DYNAMIC_LOADING
++#       endif
++#	define HEURISTIC2
++	extern char etext[];
++#	define SEARCH_FOR_DATA_START
++#   endif
+ #   ifdef NOSYS
+ #     define ALIGNMENT 4
+ #     define OS_TYPE "NOSYS"
+@@ -1848,6 +1870,17 @@
+ #	endif
+ #       define USE_GENERIC_PUSH_REGS
+ #   endif
++#   ifdef FREEBSD
++#   define ALIGNMENT 4
++#       define OS_TYPE "FREEBSD"
++#       ifdef __ELF__
++#           define DYNAMIC_LOADING
++#       endif
++#       define HEURISTIC2
++	extern char etext[];
++#       define SEARCH_FOR_DATA_START
++#   endif
++		   
+ #   ifdef LINUX
+ #       define OS_TYPE "LINUX"
+ #       define LINUX_STACKBOTTOM
+@@ -1998,6 +2031,17 @@
+ #	ifdef __ELF__
+ #	    define DYNAMIC_LOADING
+ #	endif
++#	define HEURISTIC2
++	extern char etext[];
++#	define SEARCH_FOR_DATA_START
++#   endif
++#   ifdef FREEBSD
++#       define OS_TYPE "FREEBSD"
++#       define SIG_SUSPEND SIGUSR1
++#       define SIG_THR_RESTART SIGUSR2
++#       ifdef __ELF__
++#           define DYNAMIC_LOADING
++#       endif
+ #	define HEURISTIC2
+ 	extern char etext[];
+ #	define SEARCH_FOR_DATA_START
diff -Npru ports.orig/lang/gauche/files/patch-gc__os_dep.c ports/lang/gauche/files/patch-gc__os_dep.c
--- ports.orig/lang/gauche/files/patch-gc__os_dep.c	Thu Jan  1 09:00:00 1970
+++ ports/lang/gauche/files/patch-gc__os_dep.c	Tue May  9 14:40:14 2006
@@ -0,0 +1,29 @@
+--- ./gc/os_dep.c.orig	Sat Mar  4 12:55:44 2006
++++ ./gc/os_dep.c	Tue May  9 14:38:56 2006
+@@ -694,7 +694,7 @@
+     || defined(HURD) || defined(NETBSD)
+ 	static struct sigaction old_segv_act;
+ #	if defined(IRIX5) || defined(HPUX) \
+-	|| defined(HURD) || defined(NETBSD)
++	|| defined(HURD) || defined(NETBSD) || defined(FREEBSD)
+ 	    static struct sigaction old_bus_act;
+ #	endif
+ #   else
+@@ -709,7 +709,7 @@
+ #   endif
+     {
+ #	if defined(SUNOS5SIGS) || defined(IRIX5)  \
+-        || defined(OSF1) || defined(HURD) || defined(NETBSD)
++        || defined(OSF1) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
+ 	  struct sigaction	act;
+ 
+ 	  act.sa_handler	= h;
+@@ -731,7 +731,7 @@
+ #	  else
+ 	        (void) sigaction(SIGSEGV, &act, &old_segv_act);
+ #		if defined(IRIX5) \
+-		   || defined(HPUX) || defined(HURD) || defined(NETBSD)
++		   || defined(HPUX) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
+ 		    /* 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.		*/
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list