Something like dladdr that gives me a dynamic library handle to the shared object or a way to get the handle from the shared object's base address. The file containing the shared object may have been moved or deleted so no, I can't dlopen() the filename given by dladdr.
Asked
Active
Viewed 808 times
2
-
I think you would have to patch `libdl`. There are only a handful of functions in `libdl`, and none of them do what you want. – Dietrich Epp Apr 30 '13 at 16:15
1 Answers
1
glibc's dlopen handles are based on link_map. I can iterate all link_map's and see if one has l_addr equal to the one given by dladdr. The address of that link_map is the handle.
dietlibc also uses link_map's as handles.
In the case of uClibc there is another struct - dyn_elf. It contains a pointer to a link_map. The global variable _dl_symbol_tables has a pointer to the head of a linked list of dyn_elf's.
bionic uses its own struct which contains struct link_map as a member (not a pointer).

Hristo Venev
- 972
- 5
- 17