Ilocker: Focus on Android Security (novice) qq:2597294287
Relocation is the process of linking symbolic references to symbolic definitions, which is one of the main tasks of Android linker.
When a function is called in a program, the associated call instruction must flow the control to the correct destination address during the execution period. Therefore, the so file must contain some relocation-related information, linker to complete the relocation work accordingly.
These relocation information is saved in a series of relocation items, and the structure of the relocated items is as follows:
These relocation items are located in the. Rel.plt section.
R_offset: For an executable or so file, this value is the virtual address of the storage unit to relocate.
r_info: This value gives two important information, one is the index of the symbol to reposition in the symbol table, and the other is the type of relocation to be performed. The two messages are extracted from two macros, respectively.
For 32-bit so, ELFW (R_type) is ELF32_R_SYM,ELFW (R_sym) is elf32_r_sym.
ELF Format Note (10)-Relocation (relocation)