[我试图了解可以操纵ld.so
的所有方式,但是我不了解LD_TRACE_PRELINKING
环境变量的文档。
联机帮助页上说:
LD_TRACE_PRELINKING (since glibc 2.4)
If this environment variable is defined, trace prelinking of the object whose name is assigned to this environment variable. (Use ldd(1) to get a list of the objects that might be traced.) If the object name is not recognized, then
all prelinking activity is traced.
这并不是非常有用,因为我无法找到关于上下文ld.so
中对象prelinking的任何信息,以及在激活LD_TRACE_LOADED_OBJECTS
时是否也可以跟踪到它的信息。
所以,ld.so
中的prelinking是什么,LD_TRACE_PRELINKING
如何影响ld.so
?
动态加载器/链接器(如ld.so
)必须在程序执行开始时以及动态加载共享库时执行符号解析和绑定操作。这些活动中的一些活动可以预先执行而无需实际执行程序代码,并且可以将结果缓存起来以供实际执行期间使用。这样可以缩短启动时间和总体程序执行时间。在Linux上,prelink
是驱动此优化的工具,其核心功能在ld.so
中实现。