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 uint64 entry;
13 uint64 phoff;
14 uint64 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 uint32 type;
27 uint32 flags;
28 uint64 off;
29 uint64 vaddr;
30 uint64 paddr;
31 uint64 filesz;
32 uint64 memsz;
33 uint64 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