xref: /xv6-public/elf.h (revision 801affcd)
1 //
2 // format of an ELF executable file
3 //
4 
5 #define ELF_MAGIC 0x464C457FU	/* "\x7FELF" in little endian */
6 
7 struct elfhdr {
8 	uint magic;	// must equal ELF_MAGIC
9 	uchar elf[12];
10 	ushort type;
11 	ushort machine;
12 	uint version;
13 	uint entry;
14 	uint phoff;
15 	uint shoff;
16 	uint flags;
17 	ushort ehsize;
18 	ushort phentsize;
19 	ushort phnum;
20 	ushort shentsize;
21 	ushort shnum;
22 	ushort shstrndx;
23 };
24 
25 struct proghdr {
26 	uint type;
27 	uint offset;
28 	uint va;
29 	uint pa;
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
43 
44