Last change
on this file was
e16e8f2,
checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago
|
bootstuff
|
-
Property mode set to
100644
|
File size:
2.3 KB
|
Line | |
---|
1 | /* |
---|
2 | * sys/elf32.h |
---|
3 | */ |
---|
4 | |
---|
5 | #ifndef _SYS_ELF32_H |
---|
6 | #define _SYS_ELF32_H |
---|
7 | |
---|
8 | #include <sys/elfcommon.h> |
---|
9 | |
---|
10 | /* ELF standard typedefs (yet more proof that <stdint.h> was way overdue) */ |
---|
11 | typedef uint16_t Elf32_Half; |
---|
12 | typedef int16_t Elf32_SHalf; |
---|
13 | typedef uint32_t Elf32_Word; |
---|
14 | typedef int32_t Elf32_Sword; |
---|
15 | typedef uint64_t Elf32_Xword; |
---|
16 | typedef int64_t Elf32_Sxword; |
---|
17 | |
---|
18 | typedef uint32_t Elf32_Off; |
---|
19 | typedef uint32_t Elf32_Addr; |
---|
20 | typedef uint16_t Elf32_Section; |
---|
21 | |
---|
22 | /* Dynamic header */ |
---|
23 | |
---|
24 | typedef struct elf32_dyn { |
---|
25 | Elf32_Sword d_tag; |
---|
26 | union { |
---|
27 | Elf32_Sword d_val; |
---|
28 | Elf32_Addr d_ptr; |
---|
29 | } d_un; |
---|
30 | } Elf32_Dyn; |
---|
31 | |
---|
32 | /* Relocations */ |
---|
33 | |
---|
34 | #define ELF32_R_SYM(x) ((x) >> 8) |
---|
35 | #define ELF32_R_TYPE(x) ((x) & 0xff) |
---|
36 | |
---|
37 | typedef struct elf32_rel { |
---|
38 | Elf32_Addr r_offset; |
---|
39 | Elf32_Word r_info; |
---|
40 | } Elf32_Rel; |
---|
41 | |
---|
42 | typedef struct elf32_rela { |
---|
43 | Elf32_Addr r_offset; |
---|
44 | Elf32_Word r_info; |
---|
45 | Elf32_Sword r_addend; |
---|
46 | } Elf32_Rela; |
---|
47 | |
---|
48 | /* Symbol */ |
---|
49 | |
---|
50 | typedef struct elf32_sym { |
---|
51 | Elf32_Word st_name; |
---|
52 | Elf32_Addr st_value; |
---|
53 | Elf32_Word st_size; |
---|
54 | unsigned char st_info; |
---|
55 | unsigned char st_other; |
---|
56 | Elf32_Half st_shndx; |
---|
57 | } Elf32_Sym; |
---|
58 | |
---|
59 | /* Main file header */ |
---|
60 | |
---|
61 | typedef struct elf32_hdr { |
---|
62 | unsigned char e_ident[EI_NIDENT]; |
---|
63 | Elf32_Half e_type; |
---|
64 | Elf32_Half e_machine; |
---|
65 | Elf32_Word e_version; |
---|
66 | Elf32_Addr e_entry; |
---|
67 | Elf32_Off e_phoff; |
---|
68 | Elf32_Off e_shoff; |
---|
69 | Elf32_Word e_flags; |
---|
70 | Elf32_Half e_ehsize; |
---|
71 | Elf32_Half e_phentsize; |
---|
72 | Elf32_Half e_phnum; |
---|
73 | Elf32_Half e_shentsize; |
---|
74 | Elf32_Half e_shnum; |
---|
75 | Elf32_Half e_shstrndx; |
---|
76 | } Elf32_Ehdr; |
---|
77 | |
---|
78 | /* Program header */ |
---|
79 | |
---|
80 | typedef struct elf32_phdr { |
---|
81 | Elf32_Word p_type; |
---|
82 | Elf32_Off p_offset; |
---|
83 | Elf32_Addr p_vaddr; |
---|
84 | Elf32_Addr p_paddr; |
---|
85 | Elf32_Word p_filesz; |
---|
86 | Elf32_Word p_memsz; |
---|
87 | Elf32_Word p_flags; |
---|
88 | Elf32_Word p_align; |
---|
89 | } Elf32_Phdr; |
---|
90 | |
---|
91 | /* Section header */ |
---|
92 | |
---|
93 | typedef struct elf32_shdr { |
---|
94 | Elf32_Word sh_name; |
---|
95 | Elf32_Word sh_type; |
---|
96 | Elf32_Word sh_flags; |
---|
97 | Elf32_Addr sh_addr; |
---|
98 | Elf32_Off sh_offset; |
---|
99 | Elf32_Word sh_size; |
---|
100 | Elf32_Word sh_link; |
---|
101 | Elf32_Word sh_info; |
---|
102 | Elf32_Word sh_addralign; |
---|
103 | Elf32_Word sh_entsize; |
---|
104 | } Elf32_Shdr; |
---|
105 | |
---|
106 | /* Note header */ |
---|
107 | typedef struct elf32_note { |
---|
108 | Elf32_Word n_namesz; /* Name size */ |
---|
109 | Elf32_Word n_descsz; /* Content size */ |
---|
110 | Elf32_Word n_type; /* Content type */ |
---|
111 | } Elf32_Nhdr; |
---|
112 | |
---|
113 | #endif /* _SYS_ELF32_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.