]>
Commit | Line | Data |
---|---|---|
a553f267 | 1 | //----------------------------------------------------------------------------- |
2 | // This code is licensed to you under the terms of the GNU GPL, version 2 or, | |
3 | // at your option, any later version. See the LICENSE.txt file for the text of | |
4 | // the license. | |
5 | //----------------------------------------------------------------------------- | |
6 | // ELF header | |
7 | //----------------------------------------------------------------------------- | |
8 | ||
2cab856f | 9 | #ifndef __ELF_H__ |
10 | #define __ELF_H__ | |
11 | ||
b961ef03 | 12 | typedef struct { |
13 | uint32_t p_type; | |
14 | uint32_t p_offset; | |
15 | uint32_t p_vaddr; | |
16 | uint32_t p_paddr; | |
17 | uint32_t p_filesz; | |
18 | uint32_t p_memsz; | |
19 | uint32_t p_flags; | |
20 | uint32_t p_align; | |
21 | } __attribute__((__packed__)) Elf32_Phdr; | |
22 | ||
2cab856f | 23 | #define EI_NIDENT 16 |
24 | ||
25 | typedef struct { | |
26 | unsigned char e_ident[EI_NIDENT]; | |
27 | uint16_t e_type; | |
28 | uint16_t e_machine; | |
29 | uint32_t e_version; | |
30 | uint32_t e_entry; | |
31 | uint32_t e_phoff; | |
32 | uint32_t e_shoff; | |
33 | uint32_t e_flags; | |
34 | uint16_t e_ehsize; | |
35 | uint16_t e_phentsize; | |
36 | uint16_t e_phnum; | |
37 | uint16_t e_shentsize; | |
38 | uint16_t e_shnum; | |
39 | uint16_t e_shtrndx; | |
40 | } __attribute__((__packed__)) Elf32_Ehdr; | |
41 | ||
42 | #define PT_NULL 0 | |
43 | #define PT_LOAD 1 | |
44 | #define PT_DYNAMIC 2 | |
45 | #define PT_INTERP 3 | |
46 | #define PT_NOTE 4 | |
47 | #define PT_SHLIB 5 | |
48 | #define PT_PHDR 6 | |
49 | #endif | |
50 |