How can I easily find out the direct shared object dependencies of a Linux binary in ELF format?
I'm aware of the ldd tool, but that appears to output all dependencies of a binary, including the dependencies of any shared objects that binary is dependent on.
Steps to find shared library dependency in Linux:Launch your preferred terminal application. Get absolute path of the program you want to check. Print shared object dependencies using ldd. Print verbose dependency info using ldd.
In order to view all the shared libraries used by an executable we make use of the Linux command utility known as ldd. We can easily locate the shared libraries on a Linux machine, as they usually start with lib* prefix.
Basic usage of ldd is fairly simple - just run the 'ldd' command along with an executable or shared object file name as input. So you can see all shared library dependencies have been produced in output.
You can use readelf
to explore the ELF headers. readelf -d
will list the direct dependencies as NEEDED
sections.
$ readelf -d elfbin Dynamic section at offset 0xe30 contains 22 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libssl.so.1.0.0] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000000c (INIT) 0x400520 0x000000000000000d (FINI) 0x400758 ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With