I am learning about the relocation from the ELF reference and this blog , but I can't get my head around calculating the relocation address.
1. Suppose we have two files
A
and B
of type ET_REL
, we want to merge their sections named S
during linkage; these sections include symbols SA
(in A
file) and SB
(in B
) file. If we have relocation entries and relocation offsets in A.elf
and B.elf
, I don't understand how linker avoids conflict of relocation addresses: I assume that these offsets might be the same in A.elf
and B.elf
, since these files don't know about each other during compilation.
2. What is the purpose of relocation table in ET_EXEC? I can't see why is it needed.
3. What is the purpose of the addend in relocation of Rela type?
I think that most of all I don't have a clear intuition on how the relocation looks like, step by step. There is an example in the blog , but I don't understand what happens exactly with that symbol, what is the result and how do we combine multiple sections. Any suggestions on resource to learn would be appreciated.
Asked by Question
(1 rep)
Mar 22, 2024, 01:05 PM
Last activity: Oct 2, 2024, 10:50 AM
Last activity: Oct 2, 2024, 10:50 AM