6c94f6490e
for fundamental reasons. So don't try it. Being here, don't include <machine/db_machdep.h>. No user program should use it. It shouldn't be installed at all.
48 lines
1.1 KiB
Text
48 lines
1.1 KiB
Text
$NetBSD: patch-ag,v 1.6 2006/07/26 10:57:41 drochner Exp $
|
|
|
|
--- libgc/dyn_load.c.orig 2005-04-11 16:12:45.000000000 +0200
|
|
+++ libgc/dyn_load.c
|
|
@@ -70,6 +70,11 @@
|
|
# include <dlfcn.h>
|
|
# include <link.h>
|
|
#endif
|
|
+
|
|
+#ifdef NETBSD
|
|
+#include <dlfcn.h>
|
|
+#endif
|
|
+
|
|
#ifdef SUNOS4
|
|
# include <dlfcn.h>
|
|
# include <link.h>
|
|
@@ -509,6 +514,31 @@ GC_FirstDLOpenedLinkMap()
|
|
break;
|
|
}
|
|
}
|
|
+
|
|
+#if defined(NETBSD)
|
|
+#undef dlopen
|
|
+#undef dlsym
|
|
+#undef dlclose
|
|
+ /* This is a hack. For now, it seems that NetBSD 2.0 does not provide
|
|
+ a _DYNAMIC with the neccessary DT_DEBUG information. A simple dlopen(0, RTLD_LAZY)
|
|
+ does the job. Maybe a NetBSD guru could explain this...
|
|
+ */
|
|
+ if(cachedResult == 0) {
|
|
+ void* startupSyms = dlopen(0, RTLD_LAZY);
|
|
+ dp = (ElfW(Dyn)*)dlsym(startupSyms, "_DYNAMIC");
|
|
+
|
|
+ for(; (tag = dp->d_tag) != 0; dp++ ) {
|
|
+ if( tag == DT_DEBUG ) {
|
|
+ struct link_map *lm
|
|
+ = ((struct r_debug *)(dp->d_un.d_ptr))->r_map;
|
|
+ if( lm != 0 ) cachedResult = lm->l_next; /* might be NIL */
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ dlclose(startupSyms);
|
|
+ }
|
|
+#endif
|
|
}
|
|
return cachedResult;
|
|
}
|