LDD without LDD
I often meet colleges at work who gets frustrated when they try to print the shared libraries dependencies for an ELF or library, and the ldd command is simply stripped out from target. (I do often strip targets :-) )
As if that would be a big problem.
The ldd command is not a binary executable, but a script that simple calls the runtime dynamic linker with a few environment variables set, and you may do the same! The essential environment variable in this case is LD_TRACE_LOADED_OBJECTS, that should be set to something != 0.
In short, you may do:
LD_TRACE_LOADED_OBJECTS=1 /lib/ld-linux.so.2 ./my_application.
Even the --list option may be used, but does not work on all targets.:
/lib/ld-linux.so.2 --list ./my_application.
Example outputs with ldd:
[11:16:58]marcus@tuxie:/tmp/a$ ldd ./main linux-vdso.so.1 => (0x00007fffc8bff000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f564e254000) /lib64/ld-linux-x86-64.so.2 (0x00007f564e647000)
Example output without ldd:
[11:17:23]marcus@tuxie:/tmp/a$ LD_TRACE_LOADED_OBJECTS=1 /lib64/ld-linux-x86-64.so.2 ./main linux-vdso.so.1 => (0x00007fffeecbc000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcce7700000) /lib64/ld-linux-x86-64.so.2 (0x00007fcce7af3000)
So, do not get frustrated, be happy.