summaryrefslogtreecommitdiff
path: root/dyn_load.c
diff options
context:
space:
mode:
authorTsugutomo Enami <tsugutomo.enami@jp.sony.com>2012-06-01 03:12:24 +0400
committerIvan Maidanski <ivmai@mail.ru>2012-06-01 03:16:34 +0400
commit48e412935fe5e7d610f55a80e0902300feff3b1d (patch)
treede03045e6d168b60bfadbaabb7ff5ce06fc11b31 /dyn_load.c
parent75281019c6e3eb0e9e28cc2e37ab307272f43508 (diff)
downloadbdwgc-48e412935fe5e7d610f55a80e0902300feff3b1d.tar.gz
Fix GC_FirstDLOpenedLinkMap() for FreeBSD 9 release
* dyn_load.c: Include sys/param.h and dlfcn.h on FreeBSD. * dyn_load.c (GC_FirstDLOpenedLinkMap): Obtain link map using dlinfo() on FreeBSD if RTLD_DI_LINKMAP feature present (defined).
Diffstat (limited to 'dyn_load.c')
-rw-r--r--dyn_load.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/dyn_load.c b/dyn_load.c
index 193f307f..e76c8880 100644
--- a/dyn_load.c
+++ b/dyn_load.c
@@ -74,6 +74,8 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0;
#endif
#if defined(NETBSD)
+# include <sys/param.h>
+# include <dlfcn.h>
# include <machine/elf_machdep.h>
# define ELFSIZE ARCH_ELFSIZE
#endif
@@ -642,6 +644,11 @@ GC_FirstDLOpenedLinkMap(void)
return(0);
}
if( cachedResult == 0 ) {
+# if defined(NETBSD) && defined(RTLD_DI_LINKMAP)
+ struct link_map *lm = NULL;
+ if (!dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &lm))
+ cachedResult = lm;
+# else
int tag;
for( dp = _DYNAMIC; (tag = dp->d_tag) != 0; dp++ ) {
if( tag == DT_DEBUG ) {
@@ -651,6 +658,7 @@ GC_FirstDLOpenedLinkMap(void)
break;
}
}
+# endif /* !NETBSD || !RTLD_DI_LINKMAP */
}
return cachedResult;
}