Just by curiosity, how is the Linux dynamic linker/loader ld-linux.so*
itself linked and loaded?
The above screenshot shows that file
and ldd
seems to give contradictory result: one says statically linked, the other says dynamically linked.
Then how is the loader itself be loaded?
ld-linux.so*
doesn't depends any other libraries. It is runable by itself when loaded to memory.
ldd
is a script, it loads the object file via the loader, and the loader checks whether the object is dynamically or statically linked, try this:
LD_TRACE_LOADED_OBJECTS=1 /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2
file
reads the magic number or elf header to figure whether the object is dynamically or statically linked, it may output different value from ldd
IMO, ld-linux.so
is static linked, because it doesn't have an .interp
section which all dynamically linked object must have.