6 typedef uint32_t Elf32_Addr;
7 typedef uint32_t Elf32_Off;
8 typedef uint16_t Elf32_Half;
9 typedef uint32_t Elf32_Word;
10 typedef int32_t Elf32_Sword;
12 typedef uint64_t Elf64_Addr;
13 typedef uint64_t Elf64_Off;
14 typedef uint16_t Elf64_Half;
15 typedef uint32_t Elf64_Word;
16 typedef int32_t Elf64_Sword;
17 typedef uint64_t Elf64_Xword;
18 typedef int64_t Elf64_Sxword;
23 unsigned char e_ident[EI_NIDENT];
32 Elf32_Half e_phentsize;
34 Elf32_Half e_shentsize;
36 Elf32_Half e_shstrndx;
40 unsigned char e_ident[EI_NIDENT];
49 Elf64_Half e_phentsize;
51 Elf64_Half e_shentsize;
53 Elf64_Half e_shstrndx;
66 Elf32_Word sh_addralign;
67 Elf32_Word sh_entsize;
79 Elf64_Xword sh_addralign;
80 Elf64_Xword sh_entsize;
103 #define PT_LOOS 0x60000000
104 #define PT_HIOS 0x6fffffff
105 #define PT_LOPROC 0x70000000
106 #define PT_HIPROC 0x7fffffff
111 Elf32_Word ch_addralign;
116 Elf64_Word ch_reserved;
118 Elf64_Xword ch_addralign;
125 unsigned char st_info;
126 unsigned char st_other;
132 unsigned char st_info;
133 unsigned char st_other;
148 Elf32_Sword r_addend;
159 Elf64_Sxword r_addend;
170 /* extern Elf32_Dyn _DYNAMIC[]; */
180 /* extern Elf64_Dyn _DYNAMIC[]; */
184 #define DT_PLTRELSZ 2
198 #define DT_SYMBOLIC 16
204 #define DT_TEXTREL 22
206 #define DT_BIND_NOW 24
207 #define DT_INIT_ARRAY 25
208 #define DT_FINI_ARRAY 26
209 #define DT_INIT_ARRAYSZ 27
210 #define DT_FINI_ARRAYSZ 28
211 #define DT_RUNPATH 29
213 #define DT_ENCODING 32
214 #define DT_PREINIT_ARRAY 32
215 #define DT_PREINIT_ARRAYSZ 33
216 #define DT_SYMTAB_SHNDX 34
217 #define DT_LOOS 0x6000000D
218 #define DT_HIOS 0x6ffff000
219 #define DT_LOPROC 0x70000000
220 #define DT_HIPROC 0x7fffffff
222 #define DF_ORIGIN 0x1
223 #define DF_SYMBOLIC 0x2
224 #define DF_TEXTREL 0x4
225 #define DF_BIND_NOW 0x8
226 #define DF_STATIC_TLS 0x10
228 #define ELF32_R_SYM(i) ((i)>>8)
229 #define ELF32_R_TYPE(i) ((unsigned char)(i))
230 #define ELF32_R_INFO(s,t) (((s)<<8)+(unsigned char)(t))
232 #define ELF64_R_SYM(i) ((i)>>32)
233 #define ELF64_R_TYPE(i) ((i)&0xffffffffL)
234 #define ELF64_R_INFO(s,t) (((s)<<32)+((t)&0xffffffffL))
236 #define ELF32_ST_BIND(i) ((i)>>4)
237 #define ELF32_ST_TYPE(i) ((i)&0xf)
238 #define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
240 #define ELF64_ST_BIND(i) ((i)>>4)
241 #define ELF64_ST_TYPE(i) ((i)&0xf)
242 #define ELF64_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
244 #define ELF32_ST_VISIBILITY(o) ((o)&0x3)
245 #define ELF64_ST_VISIBILITY(o) ((o)&0x3)
251 #define STB_LOPROC 13
252 #define STB_HIPROC 15
257 #define STT_SECTION 3
263 #define STT_LOPROC 13
264 #define STT_HIPROC 15
266 #define STV_DEFAULT 0
267 #define STV_INTERNAL 1
269 #define STV_PROTECTED 3
271 #define GRP_COMDAT 0x1
272 #define GRP_MASKOS 0x0ff00000
273 #define GRP_MASKPROC 0xf0000000
275 #define ELFCOMPRESS_ZLIB 1
276 #define ELFCOMPRESS_LOOS 0x60000000
277 #define ELFCOMPRESS_HIOS 0x6fffffff
278 #define ELFCOMPRESS_LOPROC 0x70000000
279 #define ELFCOMPRESS_HIPROC 0x7fffffff
282 #define SHT_PROGBITS 1
287 #define SHT_DYNAMIC 6
292 #define SHT_DYNSYM 11
293 #define SHT_INIT_ARRAY 14
294 #define SHT_FINI_ARRAY 15
295 #define SHT_PREINIT_ARRAY 16
297 #define SHT_SYMTAB_SHNDX 18
298 #define SHT_LOOS 0x60000000
299 #define SHT_HIOS 0x6fffffff
300 #define SHT_LOPROC 0x70000000
301 #define SHT_HIPROC 0x7fffffff
302 #define SHT_LOUSER 0x80000000
303 #define SHT_HIUSER 0xffffffff
305 #define SHF_WRITE 0x1
306 #define SHF_ALLOC 0x2
307 #define SHF_EXECINSTR 0x4
308 #define SHF_MERGE 0x10
309 #define SHF_STRINGS 0x20
310 #define SHF_INFO_LINK 0x40
311 #define SHF_LINK_ORDER 0x80
312 #define SHF_OS_NONCONFORMING 0x100
313 #define SHF_GROUP 0x200
314 #define SHF_TLS 0x400
315 #define SHF_COMPRESSED 0x800
316 #define SHF_MASKOS 0x0ff00000
317 #define SHF_MASKPROC 0xf0000000
320 #define SHN_LORESERVE 0xff00
321 #define SHN_LOPROC 0xff00
322 #define SHN_HIPROC 0xff1f
323 #define SHN_LOOS 0xff20
324 #define SHN_HIOS 0xff3f
325 #define SHN_ABS 0xfff1
326 #define SHN_COMMON 0xfff2
327 #define SHN_XINDEX 0xffff
328 #define SHN_HIRESERVE 0xffff
335 #define ET_LOOS 0xfe00
336 #define ET_HIOS 0xfeff
337 #define ET_LOPROC 0xff00
338 #define ET_HIPROC 0xffff
350 #define EM_MIPS_RS3_LE 10
353 #define EM_SPARC32PLUS 18
366 #define EM_SPARCV9 43
367 #define EM_TRICORE 44
370 #define EM_H8_300H 47
375 #define EM_COLDFIRE 52
381 #define EM_STARCORE 58
390 #define EM_ST9PLUS 67
400 #define EM_JAVELIN 77
401 #define EM_FIREPATH 78
412 #define EM_MN10300 89
413 #define EM_MN10200 90
415 #define EM_OPENRISC 92
416 #define EM_ARC_COMPACT 93
418 #define EM_VIDEOCORE 95
419 #define EM_TMM_GPP 96
427 #define EM_F2MC16 104
428 #define EM_MSP430 105
429 #define EM_BLACKFIN 106
430 #define EM_SE_C33 107
433 #define EM_UNICORE 110
434 #define EM_EXCESS 111
436 #define EM_ALTERA_NIOS2 113
441 #define EM_DSPIC30F 118
444 #define EM_TSK3000 131
448 #define EM_SCORE7 135
450 #define EM_VIDEOCORE3 137
451 #define EM_LATTICEMICO32 138
452 #define EM_SE_C17 139
453 #define EM_TI_C6000 140
454 #define EM_TI_C2000 141
455 #define EM_TI_C5500 142
456 #define EM_TI_ARP32 143
457 #define EM_TI_PRU 144
458 #define EM_MMDSP_PLUS 160
459 #define EM_MMDSP_PLUS 160
460 #define EM_CYPRESS_M8C 161
462 #define EM_TRIMEDIA 163
465 #define EM_STXP7X 166
468 #define EM_ECOG1X 168
469 #define EM_MAXQ30 169
470 #define EM_XIMO16 170
472 #define EM_CRAYNV2 172
475 #define EM_MCST_ELBRUS 175
476 #define EM_ECOG16 176
482 #define EM_AARCH64 183
485 #define EM_TILE64 187
486 #define EM_TILEPRO 188
487 #define EM_MICROBLAZE 189
489 #define EM_TILEGX 191
490 #define EM_CLOUDSHIELD 192
491 #define EM_COREA_1ST 193
492 #define EM_COREA_2ND 194
493 #define EM_ARC_COMPACT2 195
496 #define EM_VIDEOCORE5 198
498 #define EM_56800EX 200
502 #define EM_MCHP_PIC 204
503 #define EM_INTEL205 205
504 #define EM_INTEL206 206
505 #define EM_INTEL207 207
506 #define EM_INTEL208 208
507 #define EM_INTEL209 209
517 #define EM_CSR_KALIMBA 219
519 #define EM_VISIUM 221
522 #define EM_AMDGPU 224
536 #define EI_ABIVERSION 8
545 #define ELFCLASSNONE 0
549 #define ELFDATANONE 0
550 #define ELFDATA2LSB 1
551 #define ELFDATA2MSB 2
553 #define ELFOSABI_NONE 0
554 #define ELFOSABI_HPUX 1
555 #define ELFOSABI_NETBSD 2
556 #define ELFOSABI_GNU 3
557 #define ELFOSABI_LINUX 3
558 #define ELFOSABI_SOLARIS 6
559 #define ELFOSABI_AIX 7
560 #define ELFOSABI_IRIX 8
561 #define ELFOSABI_FREEBSD 9
562 #define ELFOSABI_TRU64 10
563 #define ELFOSABI_MODESTO 11
564 #define ELFOSABI_OPENBSD 12
565 #define ELFOSABI_OPENVMS 13
566 #define ELFOSABI_NSK 14
567 #define ELFOSABI_AROS 15
568 #define ELFOSABI_FENIXOS 16
569 #define ELFOSABI_CLOUDABI 17
570 #define ELFOSABI_OPENVOS 18
573 Elf64_Ehdr *libelf_header(void *elf);
574 Elf64_Shdr *libelf_shdr(void *elf, int n);
575 Elf64_Shdr *libelf_sht_strtab(void *elf);
576 char *libelf_sectionname(Elf64_Shdr *section, Elf64_Shdr *strtab);
577 Elf64_Shdr *libelf_section_n(void *elf, int n);
578 Elf64_Shdr *libelf_section(void *elf, int type);
579 int libelf_type(void *elf);
580 int libelf_iself(void *elf);