[Gc] patch for gc to work on newer NetBSD releases

tsugutomo.enami at jp.sony.com tsugutomo.enami at jp.sony.com
Mon May 28 20:08:26 PDT 2012


Hi.

Attached patch is necessary for boehm-gc to work on newer NetBSD
release.  Without it, for example, make check fails as attached log.

The change itself is distributed for a while as a part of pkgsrc, which
is 3rd party software management system.

I hope this is integrated in the future release of boehm-gc.

enami.

-------------- next part --------------
$NetBSD: patch-ac,v 1.15 2012/05/29 03:01:15 enami Exp $

--- dyn_load.c.orig	2007-12-19 02:37:12.000000000 +0300
+++ dyn_load.c	2009-11-11 01:54:26.000000000 +0300
@@ -78,6 +78,8 @@
 #endif
 
 #if defined(NETBSD)
+#   include <sys/param.h>
+#   include <dlfcn.h>
 #   include <machine/elf_machdep.h>
 #   define ELFSIZE ARCH_ELFSIZE
 #endif
@@ -499,6 +501,15 @@
         return(0);
     }
     if( cachedResult == 0 ) {
+#if defined(NETBSD) && defined(RTLD_DI_LINKMAP)
+        struct link_map *lm = NULL;
+        int rv = dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &lm); 
+        if (rv != 0)
+            return (0);
+        if (lm == NULL)
+            return (0);
+        cachedResult = lm;
+#else  /* !(defined(NETBSD) && defined(RTLD_DI_LINKMAP)) */
         int tag;
         for( dp = _DYNAMIC; (tag = dp->d_tag) != 0; dp++ ) {
             if( tag == DT_DEBUG ) {
@@ -508,6 +519,7 @@
                 break;
             }
         }
+#endif /* !(defined(NETBSD) && defined(RTLD_DI_LINKMAP)) */
     }
     return cachedResult;
 }
-------------- next part --------------
make  check-TESTS
[1]   Segmentation fault (core dumped) ${dir}${tst}
FAIL: gctest
Leaked composite object at 0x631eb0 (tests/leak_test.c:19, sz=8, NORMAL)
        Caller at allocation:
                ##PC##= 0x4009d2

PASS: leaktest
Final heap size is 65536
PASS: middletest
GC_check_heap_block: found smashed heap objects:
0x63ffb8 in or near object at 0x63ff90(tests/smash_test.c:21, sz=40)
        Caller at allocation:
                ##PC##= 0x400942
GC_check_heap_block: found smashed heap objects:
0x63ffb8 in or near object at 0x63ff90(tests/smash_test.c:21, sz=40)
        Caller at allocation:
                ##PC##= 0x400942
GC_check_heap_block: found smashed heap objects:
0x63ffb8 in or near object at 0x63ff90(tests/smash_test.c:21, sz=40)
        Caller at allocation:
                ##PC##= 0x400942
GC_check_heap_block: found smashed heap objects:
0x6c6cb8 in or near object at 0x6c6c90(tests/smash_test.c:21, sz=40)
        Caller at allocation:
                ##PC##= 0x400942
0x63ffb8 in or near object at 0x63ff90(tests/smash_test.c:21, sz=40)
        Caller at allocation:
                ##PC##= 0x400942
PASS: smashtest
GC Warning: Out of Memory!  Returning NIL!
GC Warning: Out of Memory!  Returning NIL!
GC Warning: Out of Memory!  Returning NIL!
PASS: hugetest
usage: test_cpp number-of-iterations
Assuming 10 iters
Starting iteration 1
[1]   Segmentation fault (core dumped) ${dir}${tst}
FAIL: test_cpp
==================================
2 of 6 tests failed
Please report to Hans.Boehm at hp.com
==================================
*** Error code 1

Stop.


More information about the Gc mailing list