6 typedef uint16_t Elf32_Half
;
7 typedef uint16_t Elf64_Half
;
9 typedef uint32_t Elf32_Word
;
10 typedef int32_t Elf32_Sword
;
11 typedef uint32_t Elf64_Word
;
12 typedef int32_t Elf64_Sword
;
14 typedef uint32_t Elf32_Addr
;
15 typedef uint32_t Elf32_Off
;
16 typedef uint16_t Elf32_Section
;
17 typedef uint64_t Elf64_Addr
;
18 typedef uint64_t Elf64_Off
;
19 typedef uint16_t Elf64_Section
;
21 typedef uint64_t Elf64_Xword
;
22 typedef int64_t Elf64_Sxword
;
24 #define EI_NIDENT (16)
27 unsigned char e_ident
[EI_NIDENT
];
36 Elf32_Half e_phentsize
;
38 Elf32_Half e_shentsize
;
40 Elf32_Half e_shstrndx
;
44 unsigned char e_ident
[EI_NIDENT
];
53 Elf64_Half e_phentsize
;
55 Elf64_Half e_shentsize
;
57 Elf64_Half e_shstrndx
;
60 #define ELFMAG "\177ELF"
64 #define ELFCLASSNONE 0
78 #define ELFOSABI_NONE 0
79 #define ELFOSABI_SYSV 0
80 #define ELFOSABI_HPUX 1
81 #define ELFOSABI_NETBSD 2
82 #define ELFOSABI_LINUX 3
83 #define ELFOSABI_SOLARIS 6
84 #define ELFOSABI_AIX 7
85 #define ELFOSABI_IRIX 8
86 #define ELFOSABI_FREEBSD 9
87 #define ELFOSABI_TRU64 10
88 #define ELFOSABI_MODESTO 11
89 #define ELFOSABI_OPENBSD 12
90 #define ELFOSABI_ARM 97
91 #define ELFOSABI_STANDALONE 255
93 #define EI_ABIVERSION 8
103 #define ET_LOOS 0xfe00
104 #define ET_HIOS 0xfeff
105 #define ET_LOPROC 0xff00
106 #define ET_HIPROC 0xffff
117 #define EM_MIPS_RS3_LE 10
121 #define EM_SPARC32PLUS 18
132 #define EM_FAKE_ALPHA 41
134 #define EM_SPARCV9 43
135 #define EM_TRICORE 44
138 #define EM_H8_300H 47
143 #define EM_COLDFIRE 52
149 #define EM_STARCORE 58
157 #define EM_ST9PLUS 67
167 #define EM_JAVELIN 77
168 #define EM_FIREPATH 78
179 #define EM_MN10300 89
180 #define EM_MN10200 90
182 #define EM_OPENRISC 92
186 #define EM_ALPHA 0x9026
201 Elf32_Word sh_addralign
;
202 Elf32_Word sh_entsize
;
208 Elf64_Xword sh_flags
;
214 Elf64_Xword sh_addralign
;
215 Elf64_Xword sh_entsize
;
219 #define SHN_LORESERVE 0xff00
220 #define SHN_LOPROC 0xff00
221 #define SHN_BEFORE 0xff00
223 #define SHN_AFTER 0xff01
225 #define SHN_HIPROC 0xff1f
226 #define SHN_LOOS 0xff20
227 #define SHN_HIOS 0xff3f
228 #define SHN_ABS 0xfff1
229 #define SHN_COMMON 0xfff2
230 #define SHN_XINDEX 0xffff
231 #define SHN_HIRESERVE 0xffff
234 #define SHT_PROGBITS 1
239 #define SHT_DYNAMIC 6
244 #define SHT_DYNSYM 11
245 #define SHT_INIT_ARRAY 14
246 #define SHT_FINI_ARRAY 15
247 #define SHT_PREINIT_ARRAY 16
249 #define SHT_SYMTAB_SHNDX 18
251 #define SHT_LOPROC 0x70000000
252 #define SHT_HIPROC 0x7fffffff
253 #define SHT_LOUSER 0x80000000
254 #define SHT_HIUSER 0x8fffffff
256 #define SHF_WRITE (1 << 0)
257 #define SHF_ALLOC (1 << 1)
258 #define SHF_EXECINSTR (1 << 2)
259 #define SHF_MERGE (1 << 4)
260 #define SHF_STRINGS (1 << 5)
261 #define SHF_INFO_LINK (1 << 6)
262 #define SHF_LINK_ORDER (1 << 7)
263 #define SHF_OS_NONCONFORMING (1 << 8)
265 #define SHF_GROUP (1 << 9)
266 #define SHF_TLS (1 << 10)
267 #define SHF_MASKOS 0x0ff00000
268 #define SHF_MASKPROC 0xf0000000
269 #define SHF_ORDERED (1 << 30)
270 #define SHF_EXCLUDE (1 << 31)
272 #define GRP_COMDAT 0x1
278 unsigned char st_info
;
279 unsigned char st_other
;
280 Elf32_Section st_shndx
;
285 unsigned char st_info
;
286 unsigned char st_other
;
287 Elf64_Section st_shndx
;
292 #define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
293 #define ELF32_ST_TYPE(val) ((val) & 0xf)
294 #define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
296 #define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
297 #define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
298 #define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
305 #define STB_GNU_UNIQUE 10
307 #define STB_LOPROC 13
308 #define STB_HIPROC 15
313 #define STT_SECTION 3
319 #define STT_GNU_IFUNC 10
321 #define STT_LOPROC 13
322 #define STT_HIPROC 15
326 #define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
327 #define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
329 #define STV_DEFAULT 0
330 #define STV_INTERNAL 1
332 #define STV_PROTECTED 3
343 Elf32_Sword r_addend
;
349 Elf64_Sxword r_addend
;
352 #define ELF32_R_SYM(val) ((val) >> 8)
353 #define ELF32_R_TYPE(val) ((val) & 0xff)
354 #define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
356 #define ELF64_R_SYM(i) ((i) >> 32)
357 #define ELF64_R_TYPE(i) ((i) & 0xffffffff)
358 #define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type))
377 Elf64_Xword p_filesz
;
391 #define PT_LOPROC 0x70000000
392 #define PT_HIPROC 0x7fffffff
394 #define PF_X (1 << 0)
395 #define PF_W (1 << 1)
396 #define PF_R (1 << 2)
397 #define PF_MASKOS 0x0ff00000
398 #define PF_MASKPROC 0xf0000000
400 #define NT_PRSTATUS 1
401 #define NT_FPREGSET 2
402 #define NT_PRPSINFO 3
404 #define NT_TASKSTRUCT 4
405 #define NT_PLATFORM 5
407 #define NT_GWINDOWS 7
409 #define NT_PSTATUS 10
412 #define NT_UTSNAME 15
413 #define NT_LWPSTATUS 16
414 #define NT_LWPSINFO 17
415 #define NT_PRFPXREG 20
416 #define NT_PRXFPREG 0x46e62b7f
417 #define NT_PPC_VMX 0x100
418 #define NT_PPC_SPE 0x101
419 #define NT_PPC_VSX 0x102
420 #define NT_386_TLS 0x200
421 #define NT_386_IOPERM 0x201
427 #define R_386_GOT32 3
428 #define R_386_PLT32 4
430 #define R_386_GLOB_DAT 6
431 #define R_386_JMP_SLOT 7
432 #define R_386_RELATIVE 8
433 #define R_386_GOTOFF 9
434 #define R_386_GOTPC 10
435 #define R_386_32PLT 11
436 #define R_386_TLS_TPOFF 14
437 #define R_386_TLS_IE 15
438 #define R_386_TLS_GOTIE 16
439 #define R_386_TLS_LE 17
440 #define R_386_TLS_GD 18
441 #define R_386_TLS_LDM 19
443 #define R_386_PC16 21
446 #define R_386_TLS_GD_32 24
447 #define R_386_TLS_GD_PUSH 25
448 #define R_386_TLS_GD_CALL 26
449 #define R_386_TLS_GD_POP 27
450 #define R_386_TLS_LDM_32 28
451 #define R_386_TLS_LDM_PUSH 29
452 #define R_386_TLS_LDM_CALL 30
453 #define R_386_TLS_LDM_POP 31
454 #define R_386_TLS_LDO_32 32
455 #define R_386_TLS_IE_32 33
456 #define R_386_TLS_LE_32 34
457 #define R_386_TLS_DTPMOD32 35
458 #define R_386_TLS_DTPOFF32 36
459 #define R_386_TLS_TPOFF32 37
460 #define R_386_TLS_GOTDESC 39
461 #define R_386_TLS_DESC_CALL 40
462 #define R_386_TLS_DESC 41
463 #define R_386_IRELATIVE 42
466 #define EF_ARM_RELEXEC 0x01
467 #define EF_ARM_HASENTRY 0x02
468 #define EF_ARM_INTERWORK 0x04
469 #define EF_ARM_APCS_26 0x08
470 #define EF_ARM_APCS_FLOAT 0x10
471 #define EF_ARM_PIC 0x20
472 #define EF_ARM_ALIGN8 0x40
473 #define EF_ARM_NEW_ABI 0x80
474 #define EF_ARM_OLD_ABI 0x100
475 #define EF_ARM_SOFT_FLOAT 0x200
476 #define EF_ARM_VFP_FLOAT 0x400
477 #define EF_ARM_MAVERICK_FLOAT 0x800
479 #define EF_ARM_SYMSARESORTED 0x04
480 #define EF_ARM_DYNSYMSUSESEGIDX 0x08
481 #define EF_ARM_MAPSYMSFIRST 0x10
482 #define EF_ARM_EABIMASK 0XFF000000
484 #define EF_ARM_BE8 0x00800000
485 #define EF_ARM_LE8 0x00400000
487 #define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
488 #define EF_ARM_EABI_UNKNOWN 0x00000000
489 #define EF_ARM_EABI_VER1 0x01000000
490 #define EF_ARM_EABI_VER2 0x02000000
491 #define EF_ARM_EABI_VER3 0x03000000
492 #define EF_ARM_EABI_VER4 0x04000000
493 #define EF_ARM_EABI_VER5 0x05000000
495 #define STT_ARM_TFUNC STT_LOPROC
496 #define STT_ARM_16BIT STT_HIPROC
498 #define SHF_ARM_ENTRYSECT 0x10000000
499 #define SHF_ARM_COMDEF 0x80000000
501 #define PF_ARM_SB 0x10000000
503 #define PF_ARM_PI 0x20000000
504 #define PF_ARM_ABS 0x40000000
506 #define PT_ARM_EXIDX (PT_LOPROC + 1)
508 #define SHT_ARM_EXIDX (SHT_LOPROC + 1)
509 #define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2)
510 #define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3)
514 #define R_ARM_ABS32 2
515 #define R_ARM_REL32 3
517 #define R_ARM_ABS16 5
518 #define R_ARM_ABS12 6
519 #define R_ARM_THM_ABS5 7
521 #define R_ARM_SBREL32 9
522 #define R_ARM_THM_PC22 10
523 #define R_ARM_THM_PC8 11
524 #define R_ARM_AMP_VCALL9 12
525 #define R_ARM_SWI24 13
526 #define R_ARM_THM_SWI8 14
527 #define R_ARM_XPC25 15
528 #define R_ARM_THM_XPC22 16
529 #define R_ARM_TLS_DTPMOD32 17
530 #define R_ARM_TLS_DTPOFF32 18
531 #define R_ARM_TLS_TPOFF32 19
532 #define R_ARM_COPY 20
533 #define R_ARM_GLOB_DAT 21
534 #define R_ARM_JUMP_SLOT 22
535 #define R_ARM_RELATIVE 23
536 #define R_ARM_GOTOFF 24
537 #define R_ARM_GOTPC 25
538 #define R_ARM_GOT32 26
539 #define R_ARM_PLT32 27
540 #define R_ARM_ALU_PCREL_7_0 32
541 #define R_ARM_ALU_PCREL_15_8 33
542 #define R_ARM_ALU_PCREL_23_15 34
543 #define R_ARM_LDR_SBREL_11_0 35
544 #define R_ARM_ALU_SBREL_19_12 36
545 #define R_ARM_ALU_SBREL_27_20 37
546 #define R_ARM_GNU_VTENTRY 100
547 #define R_ARM_GNU_VTINHERIT 101
548 #define R_ARM_THM_PC11 102
549 #define R_ARM_THM_PC9 103
550 #define R_ARM_TLS_GD32 104
552 #define R_ARM_TLS_LDM32 105
554 #define R_ARM_TLS_LDO32 106
556 #define R_ARM_TLS_IE32 107
558 #define R_ARM_TLS_LE32 108
560 #define R_ARM_RXPC25 249
561 #define R_ARM_RSBREL32 250
562 #define R_ARM_THM_RPC22 251
563 #define R_ARM_RREL32 252
564 #define R_ARM_RABS22 253
565 #define R_ARM_RPC24 254
566 #define R_ARM_RBASE 255
568 #define R_ARM_NUM 256
570 #define R_X86_64_NONE 0
571 #define R_X86_64_64 1
572 #define R_X86_64_PC32 2
573 #define R_X86_64_GOT32 3
574 #define R_X86_64_PLT32 4
575 #define R_X86_64_COPY 5
576 #define R_X86_64_GLOB_DAT 6
577 #define R_X86_64_JUMP_SLOT 7
578 #define R_X86_64_RELATIVE 8
579 #define R_X86_64_GOTPCREL 9
581 #define R_X86_64_32 10
582 #define R_X86_64_32S 11
583 #define R_X86_64_16 12
584 #define R_X86_64_PC16 13
585 #define R_X86_64_8 14
586 #define R_X86_64_PC8 15
587 #define R_X86_64_DTPMOD64 16
588 #define R_X86_64_DTPOFF64 17
589 #define R_X86_64_TPOFF64 18
590 #define R_X86_64_TLSGD 19
592 #define R_X86_64_TLSLD 20
593 #define R_X86_64_DTPOFF32 21
594 #define R_X86_64_GOTTPOFF 22
595 #define R_X86_64_TPOFF32 23
596 #define R_X86_64_PC64 24
597 #define R_X86_64_GOTOFF64 25
598 #define R_X86_64_GOTPC32 26
599 #define R_X86_64_GOTPC32_TLSDESC 34
600 #define R_X86_64_TLSDESC_CALL 35
602 #define R_X86_64_TLSDESC 36
603 #define R_X86_64_IRELATIVE 37
605 #define R_X86_64_NUM 38