ELF Tutorial: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
m Use <stdbool.h> instead of a poor replacement
→‎Relocation Sections: removed "The" from end of code and placed it at start of next paragraph
Line 451: Line 451:
Elf32_Word r_info;
Elf32_Word r_info;
Elf32_Sword r_addend;
Elf32_Sword r_addend;
} Elf32_Rela;The
} Elf32_Rela;
</source>
</source>


Above are the defintions for the different structure types for relocations. Of note if the value stored in '''r_info''', as the upper byte designates the entry in the symbol table to which the relocation applies, whereas the lower byte stores the type of relocation that should be applied. Note that an ELF file may have multiple symbol tables, thus the index of the section header table that refers to the symbol table to which these relocation apply can be found in the '''sh_link''' field on this relocation table's section header. The value in '''r_offset''' gives the relative position of the symbol that is being relocated, within its section.
The above are the defintions for the different structure types for relocations. Of note if the value stored in '''r_info''', as the upper byte designates the entry in the symbol table to which the relocation applies, whereas the lower byte stores the type of relocation that should be applied. Note that an ELF file may have multiple symbol tables, thus the index of the section header table that refers to the symbol table to which these relocation apply can be found in the '''sh_link''' field on this relocation table's section header. The value in '''r_offset''' gives the relative position of the symbol that is being relocated, within its section.


<source lang="cpp">
<source lang="cpp">