2 * Definitions needed for accessing ELF headers
5 uchar ident[16]; /* ident bytes */
6 ushort type; /* file type */
7 ushort machine; /* target machine */
8 int version; /* file version */
9 ulong elfentry; /* start address */
10 ulong phoff; /* phdr file offset */
11 ulong shoff; /* shdr file offset */
12 int flags; /* file flags */
13 ushort ehsize; /* sizeof ehdr */
14 ushort phentsize; /* sizeof phdr */
15 ushort phnum; /* number phdrs */
16 ushort shentsize; /* sizeof shdr */
17 ushort shnum; /* number shdrs */
18 ushort shstrndx; /* shdr string index */
22 u8int ident[16]; /* ident bytes */
23 u16int type; /* file type */
24 u16int machine; /* target machine */
25 u32int version; /* file version */
26 u64int elfentry; /* start address */
27 u64int phoff; /* phdr file offset */
28 u64int shoff; /* shdr file offset */
29 u32int flags; /* file flags */
30 u16int ehsize; /* sizeof ehdr */
31 u16int phentsize; /* sizeof phdr */
32 u16int phnum; /* number phdrs */
33 u16int shentsize; /* sizeof shdr */
34 u16int shnum; /* number shdrs */
35 u16int shstrndx; /* shdr string index */
39 int type; /* entry type */
40 ulong offset; /* file offset */
41 ulong vaddr; /* virtual address */
42 ulong paddr; /* physical address */
43 int filesz; /* file size */
44 ulong memsz; /* memory size */
45 int flags; /* entry flags */
46 int align; /* memory/file alignment */
50 u32int type; /* entry type */
51 u32int flags; /* entry flags */
52 u64int offset; /* file offset */
53 u64int vaddr; /* virtual address */
54 u64int paddr; /* physical address */
55 u64int filesz; /* file size */
56 u64int memsz; /* memory size */
57 u64int align; /* memory/file alignment */
61 ulong name; /* section name */
62 ulong type; /* SHT_... */
63 ulong flags; /* SHF_... */
64 ulong addr; /* virtual address */
65 ulong offset; /* file offset */
66 ulong size; /* section size */
67 ulong link; /* misc info */
68 ulong info; /* misc info */
69 ulong addralign; /* memory alignment */
70 ulong entsize; /* entry size if table */
74 u32int name; /* section name */
75 u32int type; /* SHT_... */
76 u64int flags; /* SHF_... */
77 u64int addr; /* virtual address */
78 u64int offset; /* file offset */
79 u64int size; /* section size */
80 u32int link; /* misc info */
81 u32int info; /* misc info */
82 u64int addralign; /* memory alignment */
83 u64int entsize; /* entry size if table */
88 MAG0 = 0, /* ident[] indexes */
96 ELFCLASSNONE = 0, /* ident[CLASS] */
101 ELFDATANONE = 0, /* ident[DATA] */
106 NOETYPE = 0, /* type */
112 NONE = 0, /* machine */
113 M32 = 1, /* AT&T WE 32100 */
114 SPARC = 2, /* Sun SPARC */
115 I386 = 3, /* Intel 80386 */
116 M68K = 4, /* Motorola 68000 */
117 M88K = 5, /* Motorola 88000 */
118 I486 = 6, /* Intel 80486 */
119 I860 = 7, /* Intel i860 */
120 MIPS = 8, /* Mips R2000 */
121 S370 = 9, /* Amdhal */
122 SPARC64 = 18, /* Sun SPARC v9 */
123 POWER = 20, /* PowerPC */
124 POWER64 = 21, /* PowerPC64 */
126 AMD64 = 62, /* Amd64 */
127 ARM64 = 183, /* ARM64 */
129 NO_VERSION = 0, /* version, ident[VERSION] */
133 NOPTYPE = 0, /* type */
146 Progbits = 1, /* section types */
150 Swrite = 1, /* section attributes */
155 #define ELF_MAG ((0x7f<<24) | ('E'<<16) | ('L'<<8) | 'F')