在ld.so的上下文中什么是预链接,以及LD_TRACE_PRELINKING对其有何影响

问题描述 投票:0回答:1

[我试图了解可以操纵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

linker ld
1个回答
1
投票

动态加载器/链接器(如ld.so)必须在程序执行开始时以及动态加载共享库时执行符号解析和绑定操作。这些活动中的一些活动可以预先执行而无需实际执行程序代码,并且可以将结果缓存起来以供实际执行期间使用。这样可以缩短启动时间和总体程序执行时间。在Linux上,prelink是驱动此优化的工具,其核心功能在ld.so中实现。

© www.soinside.com 2019 - 2024. All rights reserved.