문제

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.

도움이 되었습니까?

해결책

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).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top