ELF Format Note (10)-Relocation (relocation)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.