xref: /xv6-public/elf.h (revision dfcc5b99)
1 //
2 // format of an ELF executable file
3 // from JOS
4 //
5 
6 #define ELF_MAGIC 0x464C457FU	/* "\x7FELF" in little endian */
7 
8 struct elfhdr {
9 	uint magic;	// must equal ELF_MAGIC
10 	uchar elf[12];
11 	ushort type;
12 	ushort machine;
13 	uint version;
14 	uint entry;
15 	uint phoff;
16 	uint shoff;
17 	uint flags;
18 	ushort ehsize;
19 	ushort phentsize;
20 	ushort phnum;
21 	ushort shentsize;
22 	ushort shnum;
23 	ushort shstrndx;
24 };
25 
26 struct proghdr {
27 	uint type;
28 	uint offset;
29 	uint va;
30 	uint pa;
31 	uint filesz;
32 	uint memsz;
33 	uint flags;
34 	uint align;
35 };
36 
37 // Values for Proghdr type
38 #define ELF_PROG_LOAD		1
39 
40 // Flag bits for Proghdr flags
41 #define ELF_PROG_FLAG_EXEC	1
42 #define ELF_PROG_FLAG_WRITE	2
43 #define ELF_PROG_FLAG_READ	4
44 
45