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 | |
85f2819c |
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 | |
50 | #define ELFCLASS32 1 |
51 | #define ELFCLASS64 2 |
52 | |
53 | #define ELFDATA2LSB 1 |
54 | #define ELFDATA2MSB 2 |
55 | |
56 | #define EV_CURRENT 1 |
57 | |
58 | #define ET_NONE 0 |
59 | #define ET_REL 1 |
60 | #define ET_EXEC 2 |
61 | #define ET_DYN 3 |
62 | #define ET_CORE 4 |
63 | |
64 | #define EM_ARM 0x28 |
65 | |
66 | #define PF_R 4 |
67 | #define PF_W 2 |
68 | #define PF_X 1 |
69 | |
2cab856f |
70 | #endif |
71 | |