Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build_scripts/layout.ld: add a relro section
This accomadates situations for example: where global variables are initialized to a value that requires relocation. Things like globally stored function pointers, or storing the address of another global variable. Such items require runtime initialization in the form of dynamic relocation, and cannot be placed in a RO segment. However, as it is declared to be a constant (not modified by the program), the dynamic linker can mark it as RO after the dynamic relocation as been applied [1]. When GCC sees a variable which is constant but requires dynamic relocation, it puts it into a section named `.data.rel.ro`, further, a variable that requires dynamic relocation against a local symbol is put into a `.data.rel.ro.local` section, this helps group such variables together so that the dynamic linker may apply the relocations, which will always be RELATIVE locations [1]. [1] https://www.airs.com/blog/archives/189 Signed-off-by: Wilfred Mallawa <[email protected]>
- Loading branch information