What is the .data.rel.ro used for?

前端 未结 1 1679
庸人自扰
庸人自扰 2021-02-19 01:33

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

1条回答
  •  心在旅途
    2021-02-19 02:12

    I found the answer here:

    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.

    0 讨论(0)
提交回复
热议问题