2 * (C) Copyright 2007-2010 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
19 #define EI_ABIVERSION 8
28 #define ELFCLASSNONE 0
38 #define ELFOSABI_NONE 0
45 #define ET_LOOS 0xfe00
46 #define ET_HIOS 0xfeff
47 #define ET_LOPROC 0xff00
48 #define ET_HIPROC 0xffff
53 #define SHT_PROGBITS 1
64 #define SHT_INIT_ARRAY 14
65 #define SHT_FINI_ARRAY 15
66 #define SHT_PREINI_ARRAY 16
68 #define SHT_SYMTAB_SHNDX 18
69 #define SHT_LOOS 0x60000000
70 #define SHT_HIOS 0x6fffffff
71 #define SHT_LOPROC 0x70000000
72 #define SHT_HIPROC 0x7fffffff
73 #define SHT_LOUSER 0x80000000
74 #define SHT_HIUSER 0xffffffff
84 #define PT_LOOS 0x60000000
85 #define PT_HIOS 0x6fffffff
86 #define PT_LOPROC 0x70000000
87 #define PT_HIPROC 0x7fffffff
92 #define PF_MASKOS 0x0ff00000
93 #define PF_MAKSPROC 0xf0000000
100 #define STB_LOPROC 13
101 #define STB_HIPROC 15
106 #define STT_SECTION 3
110 #define STT_LOPROC 13
111 #define STT_HIPROC 15
113 typedef u32 Elf32_Addr
;
114 typedef u32 Elf32_Off
;
115 typedef u16 Elf32_Half
;
116 typedef u32 Elf32_Word
;
117 typedef s32 Elf32_Sword
;
119 typedef u64 Elf64_Addr
;
120 typedef u64 Elf64_Off
;
121 typedef u16 Elf64_Half
;
122 typedef u32 Elf64_Word
;
123 typedef s32 Elf64_Sword
;
124 typedef u64 Elf64_Xword
;
125 typedef s64 Elf64_Sxword
;
131 unsigned char e_ident
[EI_NIDENT
]; /* ELF identification */
132 Elf32_Half e_type
; /* Object file type */
133 Elf32_Half e_machine
; /* Machine type */
134 Elf32_Word e_version
; /* Object file version */
135 Elf32_Addr e_entry
; /* Entry point address */
136 Elf32_Off e_phoff
; /* Program header offset */
137 Elf32_Off e_shoff
; /* Section header offset */
138 Elf32_Word e_flags
; /* Processor-specific flags */
139 Elf32_Half e_ehsize
; /* ELF header size */
140 Elf32_Half e_phentsize
; /* Size of program header entry */
141 Elf32_Half e_phnum
; /* Number of program header entries */
142 Elf32_Half e_shentsize
; /* Size of section header entries */
143 Elf32_Half e_shnum
; /* Number of section header entries */
144 Elf32_Half e_shstrndx
; /* Section name string table index */
148 unsigned char e_ident
[EI_NIDENT
]; /* ELF identification */
149 Elf64_Half e_type
; /* Object file type */
150 Elf64_Half e_machine
; /* Machine type */
151 Elf64_Word e_version
; /* Object file version */
152 Elf64_Addr e_entry
; /* Entry point address */
153 Elf64_Off e_phoff
; /* Program header offset */
154 Elf64_Off e_shoff
; /* Section header offset */
155 Elf64_Word e_flags
; /* Processor-specific flags */
156 Elf64_Half e_ehsize
; /* ELF header size */
157 Elf64_Half e_phentsize
; /* Size of program header entry */
158 Elf64_Half e_phnum
; /* Number of program header entries */
159 Elf64_Half e_shentsize
; /* Size of section header entries */
160 Elf64_Half e_shnum
; /* Number of section header entries */
161 Elf64_Half e_shstrndx
; /* Section name string table index */
164 /* combined header for easy pointer casting */
174 Elf32_Word sh_name
; /* Section name */
175 Elf32_Word sh_type
; /* Section type */
176 Elf32_Word sh_flags
; /* Section attributes */
177 Elf32_Addr sh_addr
; /* Virtual address in memory */
178 Elf32_Off sh_offset
; /* Offset in file */
179 Elf32_Word sh_size
; /* Size of section */
180 Elf32_Word sh_link
; /* Link to other section */
181 Elf32_Word sh_info
; /* Misc information */
182 Elf32_Word sh_addralign
; /* Address alignment boundary */
183 Elf32_Word sh_entsize
; /* Size of entries, if section has table */
187 Elf64_Word sh_name
; /* Section name */
188 Elf64_Word sh_type
; /* Section type */
189 Elf64_Xword sh_flags
; /* Section attributes */
190 Elf64_Addr sh_addr
; /* Virtual address in memory */
191 Elf64_Off sh_offset
; /* Offset in file */
192 Elf64_Xword sh_size
; /* Size of section */
193 Elf64_Word sh_link
; /* Link to other section */
194 Elf64_Word sh_info
; /* Misc information */
195 Elf64_Xword sh_addralign
; /* Address alignment boundary */
196 Elf64_Xword sh_entsize
; /* Size of entries, if section has table */
199 /* combined header for easy pointer casting */
209 Elf32_Word p_type
; /* Segment type */
210 Elf32_Off p_offset
; /* Segment file offset */
211 Elf32_Addr p_vaddr
; /* Segment virt. addr */
212 Elf32_Addr p_paddr
; /* <undefined> */
213 Elf32_Word p_filesz
; /* Segment size in file */
214 Elf32_Word p_memsz
; /* Segment size in mem */
215 Elf32_Word p_flags
; /* Segment flags */
216 Elf32_Word p_align
; /* Segment alignment */
220 Elf64_Word p_type
; /* Segment type */
221 Elf64_Word p_flags
; /* Segment file offset */
222 Elf64_Off p_offset
; /* Segment virt. addr */
223 Elf64_Addr p_vaddr
; /* <undefined> */
224 Elf64_Addr p_paddr
; /* Segment size in file */
225 Elf64_Xword p_filesz
; /* Segment size in mem */
226 Elf64_Xword p_memsz
; /* Segment flags */
227 Elf64_Xword p_align
; /* Segment alignment */
230 /* combined header for easy pointer casting */
237 * ELF symbol table entries
240 Elf64_Word st_name
; /* Symbol name */
241 unsigned char st_info
; /* Type and Binding attributes */
242 unsigned char st_other
; /* Reserved */
243 Elf64_Half st_shndx
; /* Section table index */
244 Elf64_Addr st_value
; /* Symbol value */
245 Elf64_Xword st_size
; /* Size of object */