1 #-------------------------------------------------------------------------------
2 # elftools: elf/enums.py
4 # Mappings of enum names to values
6 # Eli Bendersky (eliben@gmail.com)
7 # This code is in the public domain
8 #-------------------------------------------------------------------------------
9 from ..construct import Pass
12 # e_ident[EI_CLASS] in the ELF header
19 # e_ident[EI_DATA] in the ELF header
26 # e_version in the ELF header
27 ENUM_E_VERSION = dict(
33 # e_ident[EI_OSABI] in the ELF header
51 ELFOSABI_STANDALONE=255,
55 # e_type in the ELF header
67 # e_machine in the ELF header
68 # (this list is currently somewhat partial...)
69 ENUM_E_MACHINE = dict(
88 # sh_type in the section header
104 SHT_PREINIT_ARRAY=16,
109 SHT_GNU_HASH=0x6ffffff6,
110 SHT_GNU_verdef=0x6ffffffd,
111 SHT_GNU_verneed=0x6ffffffe,
112 SHT_GNU_versym=0x6fffffff,
113 SHT_LOPROC=0x70000000,
114 SHT_HIPROC=0x7fffffff,
115 SHT_LOUSER=0x80000000,
116 SHT_HIUSER=0xffffffff,
117 SHT_AMD64_UNWIND=0x70000001,
121 # p_type in the program header
122 # some values scavenged from the ELF headers in binutils-2.21
132 PT_LOPROC=0x70000000,
133 PT_HIPROC=0x7fffffff,
134 PT_GNU_EH_FRAME=0x6474e550,
135 PT_GNU_STACK=0x6474e551,
136 PT_GNU_RELRO=0x6474e552,
140 # st_info bindings in the symbol header
141 ENUM_ST_INFO_BIND = dict(
153 # st_info type in the symbol header
154 ENUM_ST_INFO_TYPE = dict(
172 # visibility from st_other
173 ENUM_ST_VISIBILITY = dict(
182 ENUM_ST_SHNDX = dict(
224 DT_PREINIT_ARRAYSZ=33,
228 DT_LOPROC=0x70000000,
229 DT_HIPROC=0x7fffffff,
231 DT_VALRNGLO=0x6ffffd00,
232 DT_GNU_PRELINKED=0x6ffffdf5,
233 DT_GNU_CONFLICTSZ=0x6ffffdf6,
234 DT_GNU_LIBLISTSZ=0x6ffffdf7,
235 DT_CHECKSUM=0x6ffffdf8,
236 DT_PLTPADSZ=0x6ffffdf9,
237 DT_MOVEENT=0x6ffffdfa,
238 DT_MOVESZ=0x6ffffdfb,
239 DT_SYMINSZ=0x6ffffdfe,
240 DT_SYMINENT=0x6ffffdff,
241 DT_GNU_HASH=0x6ffffef5,
242 DT_TLSDESC_PLT=0x6ffffef6,
243 DT_TLSDESC_GOT=0x6ffffef7,
244 DT_GNU_CONFLICT=0x6ffffef8,
245 DT_GNU_LIBLIST=0x6ffffef9,
246 DT_CONFIG=0x6ffffefa,
247 DT_DEPAUDIT=0x6ffffefb,
249 DT_PLTPAD=0x6ffffefd,
250 DT_MOVETAB=0x6ffffefe,
251 DT_SYMINFO=0x6ffffeff,
252 DT_VERSYM=0x6ffffff0,
253 DT_RELACOUNT=0x6ffffff9,
254 DT_RELCOUNT=0x6ffffffa,
255 DT_FLAGS_1=0x6ffffffb,
256 DT_VERDEF=0x6ffffffc,
257 DT_VERDEFNUM=0x6ffffffd,
258 DT_VERNEED=0x6ffffffe,
259 DT_VERNEEDNUM=0x6fffffff,
260 DT_AUXILIARY=0x7ffffffd,
261 DT_FILTER=0x7fffffff,
265 ENUM_RELOC_TYPE_i386 = dict(
289 R_386_TLS_GD_PUSH=25,
290 R_386_TLS_GD_CALL=26,
293 R_386_TLS_LDM_PUSH=29,
294 R_386_TLS_LDM_CALL=30,
295 R_386_TLS_LDM_POP=31,
299 R_386_TLS_DTPMOD32=35,
300 R_386_TLS_DTPOFF32=36,
301 R_386_TLS_TPOFF32=37,
302 R_386_TLS_GOTDESC=39,
303 R_386_TLS_DESC_CALL=40,
306 R_386_USED_BY_INTEL_200=200,
307 R_386_GNU_VTINHERIT=250,
308 R_386_GNU_VTENTRY=251,
312 ENUM_RELOC_TYPE_x64 = dict(
320 R_X86_64_JUMP_SLOT=7,
329 R_X86_64_DTPMOD64=16,
330 R_X86_64_DTPOFF64=17,
334 R_X86_64_DTPOFF32=21,
335 R_X86_64_GOTTPOFF=22,
338 R_X86_64_GOTOFF64=25,
341 R_X86_64_GOTPCREL64=28,
343 R_X86_64_GOTPLT64=30,
344 R_X86_64_PLTOFF64=31,
345 R_X86_64_GOTPC32_TLSDESC=34,
346 R_X86_64_TLSDESC_CALL=35,
348 R_X86_64_IRELATIVE=37,
349 R_X86_64_GNU_VTINHERIT=250,
350 R_X86_64_GNU_VTENTRY=251,