summaryrefslogtreecommitdiff
path: root/dyn_load.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2012-06-26 14:55:42 +0200
committerIvan Maidanski <ivmai@mail.ru>2012-06-26 14:55:42 +0200
commit94199d1d94e535c1770ce97c73e62107405f9085 (patch)
treea294f9435b05c010146e2b8b1a4f0a240ef382e4 /dyn_load.c
parentf055ed20942e8ab3a9d101d6d77470d54ae968a0 (diff)
parent98176e156503cc43cb9a5ff6d252fff0bdbf7995 (diff)
Merge branch 'gc-7_2-hotfix-2'
Diffstat (limited to 'dyn_load.c')
-rw-r--r--dyn_load.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/dyn_load.c b/dyn_load.c
index ce45ee2..39efc9b 100644
--- a/dyn_load.c
+++ b/dyn_load.c
@@ -77,6 +77,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
@@ -644,6 +646,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 ) {
@@ -653,6 +660,7 @@ GC_FirstDLOpenedLinkMap(void)
break;
}
}
+# endif /* !NETBSD || !RTLD_DI_LINKMAP */
}
return cachedResult;
}
@@ -752,6 +760,8 @@ GC_INNER void GC_register_dynamic_libraries(void)
/* Expansion, plus room for 0 record */
addr_map = (prmap_t *)GC_scratch_alloc(
(word)current_sz * sizeof(prmap_t));
+ if (addr_map == NULL)
+ ABORT("Insufficient memory for address map");
}
if (ioctl(fd, PIOCMAP, addr_map) < 0) {
GC_err_printf("fd = %d, errno = %d, needed_sz = %d, addr_map = %p\n",