comparison src/elf.h @ 0:83c23a36980d

Init
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Fri, 26 May 2017 23:11:05 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:83c23a36980d
1 // Format of an ELF executable file
2
3 #define ELF_MAGIC 0x464C457FU // "\x7FELF" in little endian
4
5 // File header
6 struct elfhdr {
7 uint magic; // must equal ELF_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 // Program section header
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 // Values for Proghdr type
37 #define ELF_PROG_LOAD 1
38
39 // Flag bits for Proghdr flags
40 #define ELF_PROG_FLAG_EXEC 1
41 #define ELF_PROG_FLAG_WRITE 2
42 #define ELF_PROG_FLAG_READ 4