问题描述
我正在使用objdump分析共享对象的内存使用情况.在.data和.rodata部分中,我看到了 .data.rel.ro 部分.
I am using objdump to analyze a shared object's memory usage. Along with the .data and .rodata sections I see a .data.rel.ro section.
有人知道这是做什么用的吗?
Anyone know what this used for?
推荐答案
我在此处:
这可用于已初始化的只读全局变量 到需要重定位的内容,例如 函数或其他全局变量.因为全局变量 需要以动态重定位的形式进行运行时初始化, 不能将其放在只读段中.但是,因为它是 声明为常量,因此可能不会被更改 程序,动态链接器可以在动态链接后将其标记为只读 重定位已应用.
This may be used for read-only global variables which are initialized to something which requires a relocation, such as the address of a function or a different global variable. Because the global variable requires a runtime initialization in the form of a dynamic relocation, it can not be placed in a read-only segment. However, because it is declared to be constant, and therefore may not be changed by the program, the dynamic linker can mark it as read-only after the dynamic relocation has been applied.
这篇关于.data.rel.ro是做什么用的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!