When I do /lib64/ld-linux-x86-64.so.2 ./a.out
it loads my a.out
program.
But how does the /lib64/ld-linux-x86-64.so.2
get loaded in the first place?
Also, what does the /lib64/ld-linux-x86-64.so.2
use underneath? Fork or Clone ... ?
When I do /lib64/ld-linux-x86-64.so.2 ./a.out
it loads my a.out
program.
But how does the /lib64/ld-linux-x86-64.so.2
get loaded in the first place?
Also, what does the /lib64/ld-linux-x86-64.so.2
use underneath? Fork or Clone ... ?
Usually /lib64/ld-linux-x86-64.so.2
it's a link to your dynamic linker.
For example, it may be a link to the /lib/x86_64-linux-gnu/ld-2.27.so
you can check the links via ls -l
command.
Also you could try to execute ld.so
file:
and you would get such output - which will answer your question:
You have invoked `ld.so', the helper program for shared library executables.
This program usually lives in the file `/lib/ld.so', and special directives
in executable files using ELF shared libraries tell the system's program
loader to load the helper program from this file. This helper program loads
the shared libraries needed by the program executable, prepares the program
to run, and runs it. You may invoke this helper program directly from the
command line to load and run an ELF executable file; this is like executing
that file itself, but always uses this helper program from the file you
specified, instead of the helper program file specified in the executable
file you run. This is mostly of use for maintainers to test new versions
of this helper program; chances are you did not intend to run this program.
And of cause refer to the manual page:
http://man7.org/linux/man-pages/man8/ld.so.8.html
And maybe if you want to really dig it out to the sources:
https://www.gnu.org/software/binutils/