Finding the load address of a shared library in Linux Finding the load address of a shared library in Linux linux linux

Finding the load address of a shared library in Linux


On a recent linux, you can use dl_iterate_phdr to find out the addresses of the shared libs.


dladdr does this, end of. :-)

More comprehnsively, dladdr will take an address and work out which library and symbol it corresponds to... and then it'll give you the name of the library, the name of the symbol, and the base addresses of each. Personally I think that's nifty, it's also making my current debugging job a lit easier.

Hope this helps!


Try to take a look at /proc/[PID]/maps file.This should contain the address of library mapping in process memory address space.

If you want to reach the executable portion, use readelf on your library and find the offset of .text section.