• Section Header
ELF文件中的Section Header定义如下(32位):
/*Section header.*/typedefstruct{
Elf32_Word sh_name;/*Section name (string tbl index)*/Elf32_Word sh_type;/*Section type*/Elf32_Word sh_flags;/*Section flags*/Elf32_Addr sh_addr;/*Section virtual addr at execution*/Elf32_Off sh_offset;/*Section file offset*/Elf32_Word sh_size;/*Section size in bytes*/Elf32_Word sh_link;/*Link to another section*/Elf32_Word sh_info;/*Additional section information*/Elf32_Word sh_addralign;/*Section alignment*/Elf32_Word sh_entsize;/*Entry size if section holds table*/} Elf32_Shdr;
• sh_type
其中的sh_type字段表示节的类型,在elf.h文件中sh_type的合法值有以下定义:
/*Legal values for sh_type (section type).*/
#define SHT_NULL 0 /* Section header table entry unused */
#define SHT_PROGBITS 1 /* Program data */
#define SHT_SYMTAB 2 /* Symbol table */
#define SHT_STRTAB 3 /* String table */
#define SHT_RELA 4 /* Relocation entries with addends */
#define SHT_HASH 5 /* Symbol hash table */
#define SHT_DYNAMIC 6 /* Dynamic linking information */
#define SHT_NOTE 7 /* Notes */
#define SHT_NOBITS 8 /* Program space with no data (bss) */
#define SHT_REL 9 /* Relocation entries, no addends */
#define SHT_SHLIB 10 /* Reserved */
#define SHT_DYNSYM 11 /* Dynamic linker symbol table */
#define SHT_INIT_ARRAY 14 /* Array of constructors */
#define SHT_FINI_ARRAY 15 /* Array of destructors */
#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
#define SHT_GROUP 17 /* Section group */
#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */
#define SHT_NUM 19 /* Number of defined types. */
#define SHT_LOOS