当我执行/lib64/ld-linux-x86-64.so.2 ./a.out
时,它会加载我的a.out
程序。
但是/lib64/ld-linux-x86-64.so.2
首先是如何加载的?
此外,/lib64/ld-linux-x86-64.so.2
在下面使用什么?叉子还是克隆...?
答案 0 :(得分:0)
通常/lib64/ld-linux-x86-64.so.2
是指向动态链接器的链接。
例如,它可能是指向/lib/x86_64-linux-gnu/ld-2.27.so
的链接
您可以通过ls -l
命令检查链接。
您还可以尝试执行ld.so
文件:
然后您将得到这样的输出-它将回答您的问题:
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.
原因请参阅手册页:
http://man7.org/linux/man-pages/man8/ld.so.8.html
也许如果您想将其真正挖掘出资源:
https://www.gnu.org/software/binutils/