Viewing shared dependencies with ldd
20 Aug 2015Today’s post is about the system utility ldd. ldd
will show you the shared object dependencies on the program that you supply as input.
I ran ldd
against an executable that I’d made from a previous post on libxml2 and was given the following results:
A word of warning is given in the man page, when using this tool however:
In the usual case, ldd invokes the standard dynamic linker (see ld.so(8)) with the LD_TRACE_LOADED_OBJECTS environment variable set to 1, which causes the linker to display the library dependencies. Be aware, however, that n some circumstances, some versions of ldd may attempt to obtain the dependency information by directly executing the program. Thus, you should never employ ldd on an untrusted executable, since this may result in the execution of arbitrary code.
The suggestion from this manual page is to use the objdump
command, as this won’t invoke anything extra to find the dependencies:
For the same program, this gives me the following output: