4 #include "output/elfcommon.h"
6 /* ELF standard typedefs (yet more proof that <stdint.h> was way overdue) */
7 typedef uint16_t Elf64_Half
;
8 typedef int16_t Elf64_SHalf
;
9 typedef uint32_t Elf64_Word
;
10 typedef int32_t Elf64_Sword
;
11 typedef uint64_t Elf64_Xword
;
12 typedef int64_t Elf64_Sxword
;
14 typedef uint64_t Elf64_Off
;
15 typedef uint64_t Elf64_Addr
;
16 typedef uint16_t Elf64_Section
;
20 typedef struct elf64_dyn
{
30 #define ELF64_R_SYM(x) ((x) >> 32)
31 #define ELF64_R_TYPE(x) ((x) & 0xffffffff)
33 typedef struct elf64_rel
{
38 typedef struct elf64_rela
{
41 Elf64_Sxword r_addend
;
45 R_X86_64_NONE
= 0, /* No reloc */
46 R_X86_64_64
= 1, /* Direct 64 bit */
47 R_X86_64_PC32
= 2, /* PC relative 32 bit signed */
48 R_X86_64_GOT32
= 3, /* 32 bit GOT entry */
49 R_X86_64_PLT32
= 4, /* 32 bit PLT address */
50 R_X86_64_COPY
= 5, /* Copy symbol at runtime */
51 R_X86_64_GLOB_DAT
= 6, /* Create GOT entry */
52 R_X86_64_JUMP_SLOT
= 7, /* Create PLT entry */
53 R_X86_64_RELATIVE
= 8, /* Adjust by program base */
54 R_X86_64_GOTPCREL
= 9, /* 32 bit signed PC relative offset to GOT */
55 R_X86_64_32
= 10, /* Direct 32 bit zero extended */
56 R_X86_64_32S
= 11, /* Direct 32 bit sign extended */
57 R_X86_64_16
= 12, /* Direct 16 bit zero extended */
58 R_X86_64_PC16
= 13, /* 16 bit sign extended pc relative */
59 R_X86_64_8
= 14, /* Direct 8 bit sign extended */
60 R_X86_64_PC8
= 15, /* 8 bit sign extended pc relative */
61 R_X86_64_DTPMOD64
= 16, /* ID of module containing symbol */
62 R_X86_64_DTPOFF64
= 17, /* Offset in module's TLS block */
63 R_X86_64_TPOFF64
= 18, /* Offset in initial TLS block */
64 R_X86_64_TLSGD
= 19, /* 32 bit signed PC relative offset
65 to two GOT entries for GD symbol */
66 R_X86_64_TLSLD
= 20, /* 32 bit signed PC relative offset
67 to two GOT entries for LD symbol */
68 R_X86_64_DTPOFF32
= 21, /* Offset in TLS block */
69 R_X86_64_GOTTPOFF
= 22, /* 32 bit signed PC relative offset
70 to GOT entry for IE symbol */
71 R_X86_64_TPOFF32
= 23, /* Offset in initial TLS block */
72 R_X86_64_PC64
= 24, /* word64 S + A - P */
73 R_X86_64_GOTOFF64
= 25, /* word64 S + A - GOT */
74 R_X86_64_GOTPC32
= 26, /* word32 GOT + A - P */
75 R_X86_64_GOT64
= 27, /* word64 G + A */
76 R_X86_64_GOTPCREL64
= 28, /* word64 G + GOT - P + A */
77 R_X86_64_GOTPC64
= 29, /* word64 GOT - P + A */
78 R_X86_64_GOTPLT64
= 30, /* word64 G + A */
79 R_X86_64_PLTOFF64
= 31, /* word64 L - GOT + A */
80 R_X86_64_SIZE32
= 32, /* word32 Z + A */
81 R_X86_64_SIZE64
= 33, /* word64 Z + A */
82 R_X86_64_GOTPC32_TLSDESC
= 34, /* word32 */
83 R_X86_64_TLSDESC_CALL
= 35, /* none */
84 R_X86_64_TLSDESC
= 36 /* word64×2 */
89 typedef struct elf64_sym
{
91 unsigned char st_info
;
92 unsigned char st_other
;
98 /* Main file header */
100 typedef struct elf64_hdr
{
101 unsigned char e_ident
[EI_NIDENT
];
103 Elf64_Half e_machine
;
104 Elf64_Word e_version
;
110 Elf64_Half e_phentsize
;
112 Elf64_Half e_shentsize
;
114 Elf64_Half e_shstrndx
;
119 typedef struct elf64_phdr
{
125 Elf64_Xword p_filesz
;
132 typedef struct elf64_shdr
{
135 Elf64_Xword sh_flags
;
141 Elf64_Xword sh_addralign
;
142 Elf64_Xword sh_entsize
;
146 typedef struct elf64_note
{
147 Elf64_Word n_namesz
; /* Name size */
148 Elf64_Word n_descsz
; /* Content size */
149 Elf64_Word n_type
; /* Content type */
152 /* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
153 #define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
154 #define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
156 #endif /* OUTPUT_ELF64_H */