Jiwon
Jiwon

Reputation: 1218

How to get library path from SONAME?

I'm developing a ldd-python script.

As far as I know, ELF binary itself has information only about library's SONAME.

How can I get library's full path by this SONAME?

I want to print like this original ldd result:

$ ldd test
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7d28000)

Upvotes: 1

Views: 385

Answers (1)

yugr
yugr

Reputation: 21896

ldd prints this information by running ld.so in special mode (LD_TRACE_LOADED_OBJECTS). So your only options are to run ldd internally and parse it's output or try to model it's behavior in Python (but note that such model would have to be quite complex, especially once you get to setuid binaries).

Upvotes: 1

Related Questions