Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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).
  • Loading branch information...
commit 48e412935fe5e7d610f55a80e0902300feff3b1d 1 parent 7528101
Tsugutomo Enami authored committed
Showing with 8 additions and 0 deletions.
  1. +8 −0 dyn_load.c
View
8 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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.