ELF Format note (9) -- st_value and st_shndx members of the Elf32_Sym structure, elf32_symst_value

Source: Internet
Author: User

ELF Format note (9) -- st_value and st_shndx members of the Elf32_Sym structure, elf32_symst_value

Ilocker: Follow Android Security (novice) QQ: 2597294287

The structure of Elf32_Sym is mentioned in the previous note. In this note, write the st_value and st_shndx members.

For different types of object files, the meaning of st_value is slightly different:

· For the relocatable (. o) file, if the corresponding st_shndx value is SHN_COMMON, st_value stores the number of aligned bytes.

· For the relocatable (. o) file, if the symbol has been defined, st_value stores the offset of the symbol in its defined section (specified by st_shndx.

· For executable and shared object (. so) files, st_value stores a virtual address. Android linker adds st_value to the base address of the file loaded to the memory to get the definition address of the symbol.

St_shndx is the index (section number) of the section that defines the symbol in the section header table ). Several special values are listed here:

· SHN_UNDEF: It usually indicates that this symbol is not defined in this file (external symbol), and android linker will perform address relocation for this symbol.

· SHN_ABS: indicates that the symbol contains an absolute (absolute) value (often an address), which is not affected by relocation. For example:

Another example is the file name symbol:

· SHN_COMMON: indicates that this symbol is a common symbol. Generally, uninitialized global variables are symbols of this type. For more information about the common symbol, see the "common block" mechanism of the linker.

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.