1
2
3 #define ELF_MAGIC 0x464C457FU
4
5
6 struct elfhdr {
7 uint magic;
8 uchar elf[12];
9 ushort type;
10 ushort machine;
11 uint version;
12 uint entry;
13 uint phoff;
14 uint shoff;
15 uint flags;
16 ushort ehsize;
17 ushort phentsize;
18 ushort phnum;
19 ushort shentsize;
20 ushort shnum;
21 ushort shstrndx;
22 };
23
24
25 struct proghdr {
26 uint type;
27 uint off;
28 uint vaddr;
29 uint paddr;
30 uint filesz;
31 uint memsz;
32 uint flags;
33 uint align;
34 };
35
36
37 #define ELF_PROG_LOAD 1
38
39
40 #define ELF_PROG_FLAG_EXEC 1
41 #define ELF_PROG_FLAG_WRITE 2
42 #define ELF_PROG_FLAG_READ 4