Elf32_Addr sh_addr;
Elf32_Off sh_offset;
Elf32_Word sh_size;
Elf32_Word sh_link;
Elf32_Word sh_info;
Elf32_Word sh_addralign;
Elf32_Word sh_entsize;
} Elf32_Shdr;
typedef struct {
Elf32_Word p_type;
Elf32_Off p_offset;
Elf32_Addr p_vaddr;
Elf32_Addr p_paddr;
Elf32_Word p_filesz;
Elf32_Word p_memsz;
Elf32_Word p_flags;
Elf32_Word p_align;
} Elf32_Phdr;
A
One of the fields in the section header structure is sh_type, which specifies the type of a section. Table 2.1 lists some section types.
Table 2.1: Section types.
NULL | Inactive header without a section. |
PROGBITS | Code or initialized data. |
SYMTAB | Symbol table for static linking. |
STRTAB | String table. |
RELA/REL | Relocation entries. |
HASH | Run-time symbol hash table. |
DYNAMIC | Information used for dynamic linking. |
NOBITS | Uninitialized data. |
DYNSYM | Symbol table for dynamic linking. |
The sh_flags field in the section header specifies the attribute of a section. Table 2.2 lists some of these attributes.
Table 2.2: Section attributes.
WRITE | Section contains writeable data. |
ALLOC | Section contains allocated data. |
EXECINSTR | Section contains executable instructions. |
Some common system-created default sections with predefined names for the PROGBITS are.text,.sdata,.data,.sbss, and.bss. Program code and constant data are contained in the.text section. This section is read-only because code and constant data are not expected to change during the lifetime of the program execution. The.sbss and.bss sections contain uninitialized data. The.sbss section stores
Other common system-defined sections are.symtab containing the symbol table,.strtab containing the string table for the program symbols,.shstrtab containing the string table for the section names, and.relaname containing the relocation information for the section named