elfshdr.h (4213B)
1 /* Special Section Indexes */ 2 #define SHN_UNDEF 0 /* undefined */ 3 #define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */ 4 #define SHN_LOPROC 0xff00 /* reserved range for processor */ 5 #define SHN_HIPROC 0xff1f /* specific section indexes */ 6 #define SHN_ABS 0xfff1 /* absolute value */ 7 #define SHN_COMMON 0xfff2 /* common symbol */ 8 #define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere. */ 9 #define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */ 10 11 /* sh_type */ 12 #define SHT_NULL 0 /* inactive */ 13 #define SHT_PROGBITS 1 /* program defined information */ 14 #define SHT_SYMTAB 2 /* symbol table section */ 15 #define SHT_STRTAB 3 /* string table section */ 16 #define SHT_RELA 4 /* relocation section with addends*/ 17 #define SHT_HASH 5 /* symbol hash table section */ 18 #define SHT_DYNAMIC 6 /* dynamic section */ 19 #define SHT_NOTE 7 /* note section */ 20 #define SHT_NOBITS 8 /* no space section */ 21 #define SHT_REL 9 /* relation section without addends */ 22 #define SHT_SHLIB 10 /* reserved - purpose unknown */ 23 #define SHT_DYNSYM 11 /* dynamic symbol table section */ 24 #define SHT_NUM 12 /* number of section types */ 25 #define SHT_INIT_ARRAY 14 /* pointers to init functions */ 26 #define SHT_FINI_ARRAY 15 /* pointers to termination functions */ 27 #define SHT_PREINIT_ARRAY 16 /* ptrs to funcs called before init */ 28 #define SHT_GROUP 17 /* defines a section group */ 29 #define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX). */ 30 #define SHT_LOOS 0x60000000 /* reserved range for OS specific */ 31 #define SHT_SUNW_dof 0x6ffffff4 /* used by dtrace */ 32 #define SHT_GNU_LIBLIST 0x6ffffff7 /* libraries to be prelinked */ 33 #define SHT_SUNW_move 0x6ffffffa /* inf for partially init'ed symbols */ 34 #define SHT_SUNW_syminfo 0x6ffffffc /* ad symbol information */ 35 #define SHT_SUNW_verdef 0x6ffffffd /* symbol versioning inf */ 36 #define SHT_SUNW_verneed 0x6ffffffe /* symbol versioning req */ 37 #define SHT_SUNW_versym 0x6fffffff /* symbol versioning table */ 38 #define SHT_HIOS 0x6fffffff /* section header types */ 39 #define SHT_LOPROC 0x70000000 /* reserved range for processor */ 40 #define SHT_HIPROC 0x7fffffff /* specific section header types */ 41 #define SHT_LOUSER 0x80000000 /* reserved range for application */ 42 #define SHT_HIUSER 0xffffffff /* specific indexes */ 43 44 #define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table section */ 45 46 /* Section Attribute Flags - sh_flags */ 47 #define SHF_WRITE 0x1 /* Writable */ 48 #define SHF_ALLOC 0x2 /* occupies memory */ 49 #define SHF_EXECINSTR 0x4 /* executable */ 50 #define SHF_MERGE 0x10 /* may be merged */ 51 #define SHF_STRINGS 0x20 /* contains strings */ 52 #define SHF_INFO_LINK 0x40 /* sh_info holds section index */ 53 #define SHF_LINK_ORDER 0x80 /* ordering requirements */ 54 #define SHF_OS_NONCONFORMING 0x100 /* OS-specific processing required */ 55 #define SHF_GROUP 0x200 /* member of section group */ 56 #define SHF_TLS 0x400 /* thread local storage */ 57 #define SHF_COMPRESSED 0x800 /* contains compressed data */ 58 #define SHF_MASKOS 0x0ff00000 /* OS-specific semantics */ 59 #define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */ 60 /* specific section attributes */ 61 62 #define ELFS32SZ 40 63 #define ELFS64SZ 64 64 65 typedef struct elf32_shdr Elf32_Shdr; 66 typedef struct elf64_shdr Elf64_Shdr; 67 68 /* Section Header */ 69 struct elf32_shdr { 70 Elf32_Word sh_name; /* section name */ 71 Elf32_Word sh_type; /* type */ 72 Elf32_Word sh_flags; /* flags */ 73 Elf32_Addr sh_addr; /* address */ 74 Elf32_Off sh_offset; /* file offset */ 75 Elf32_Word sh_size; /* section size */ 76 Elf32_Word sh_link; /* section header table index link */ 77 Elf32_Word sh_info; /* extra information */ 78 Elf32_Word sh_addralign; /* address alignment */ 79 Elf32_Word sh_entsize; /* section entry size */ 80 }; 81 82 struct elf64_shdr { 83 Elf64_Word sh_name; /* section name */ 84 Elf64_Word sh_type; /* section type */ 85 Elf64_Xword sh_flags; /* section flags */ 86 Elf64_Addr sh_addr; /* virtual address */ 87 Elf64_Off sh_offset; /* file offset */ 88 Elf64_Xword sh_size; /* section size */ 89 Elf64_Word sh_link; /* link to another */ 90 Elf64_Word sh_info; /* misc info */ 91 Elf64_Xword sh_addralign; /* memory alignment */ 92 Elf64_Xword sh_entsize; /* table entry size */ 93 };