.data.rel.ro是做什么用的? [英] What is the .data.rel.ro used for?

查看:843
本文介绍了.data.rel.ro是做什么用的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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?

推荐答案

我在此处:

gcc,GNU链接器和glibc动态链接器合作以 实现一个称为只读重定位或relro的想法.这允许 链接器以指定可执行文件的一部分,或者(通常) 动态重定位后,共享库为只读 已应用.

gcc, the GNU linker, and the glibc dynamic linker cooperate to implement an idea called read-only relocations, or relro. This permits the linker to designate a part of an executable or (more commonly) a shared library as being read-only after dynamic relocations have been applied.

这可用于已初始化的只读全局变量 到需要重定位的内容,例如 函数或其他全局变量.因为全局变量 需要以动态重定位的形式进行运行时初始化, 不能将其放在只读段中.但是,因为它是 声明为常量,因此可能不会被更改 程序,动态链接器可以在动态链接后将其标记为只读 重定位已应用.

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是做什么用的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆