The dynamic linker can be run either indirectly by running some dynamically linked program or shared object (in which case no command-line options to the dynamic linker can be passed and, in the ELF case, the dynamic linker which is stored in the .interp section of the program is executed) or directly by running:
/lib/ld-linux.so.* [OPTIONS] [PROGRAM [ARGUMENTS]]
https://jlk.fjfi.cvut.cz/arch/manpages/man/core/man-pages/ld.so.8.en
Similar info can be found in Program Library HOWTO.
But when I try,
$ LD_DEBUG=libs /usr/lib/ld-linux.so.2 ls
23325: find library=ls [0]; searching
23325: search cache=/etc/ld.so.cache
23325:
ls: error while loading shared libraries: ls: cannot open shared object file
$ LD_DEBUG=libs ls
23503: find library=libcap.so.2 [0]; searching
23503: search cache=/etc/ld.so.cache
23503: trying file=/usr/lib/libcap.so.2
...
What am I doing wrong? Is there a way to use ld-linux.so
directly to run a program?