1

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)
popeye
  • 481
  • 1
  • 4
  • 16
Jiwon
  • 1,074
  • 1
  • 11
  • 27

1 Answers1

1

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

yugr
  • 19,769
  • 3
  • 51
  • 96