From f419bcb9dcfb6af60fbf1d58d92caf4b3d62a4da Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 26 Aug 2012 21:09:26 -0400 Subject: dladdr support for dynamic linker (nonstandard extension) based on patches submitted by boris brezillon. this commit also fixes the issue whereby the main application and libc don't have the address ranges of their mappings stored, which was theoretically a problem for RTLD_NEXT support in dlsym; it didn't actually matter because libc never calls dlsym, and it seemed to be doing the right thing (by chance) for symbols in the main program as well. --- include/dlfcn.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/dlfcn.h') diff --git a/include/dlfcn.h b/include/dlfcn.h index dea74c7d..e98c8ca6 100644 --- a/include/dlfcn.h +++ b/include/dlfcn.h @@ -18,6 +18,16 @@ char *dlerror(void); void *dlopen(const char *, int); void *dlsym(void *, const char *); +#ifdef _GNU_SOURCE +typedef struct { + const char *dli_fname; + void *dli_fbase; + const char *dli_sname; + void *dli_saddr; +} Dl_info; +int dladdr(void *, Dl_info *); +#endif + #ifdef __cplusplus } #endif -- cgit v1.2.1