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 ENUM_E_MACHINE
= dict(
165 # sh_type in the section header
181 SHT_PREINIT_ARRAY
=16,
186 SHT_GNU_HASH
=0x6ffffff6,
187 SHT_GNU_verdef
=0x6ffffffd,
188 SHT_GNU_verneed
=0x6ffffffe,
189 SHT_GNU_versym
=0x6fffffff,
190 SHT_LOPROC
=0x70000000,
191 SHT_HIPROC
=0x7fffffff,
192 SHT_LOUSER
=0x80000000,
193 SHT_HIUSER
=0xffffffff,
194 SHT_AMD64_UNWIND
=0x70000001,
198 # p_type in the program header
199 # some values scavenged from the ELF headers in binutils-2.21
209 PT_LOPROC
=0x70000000,
210 PT_HIPROC
=0x7fffffff,
211 PT_GNU_EH_FRAME
=0x6474e550,
212 PT_GNU_STACK
=0x6474e551,
213 PT_GNU_RELRO
=0x6474e552,
217 # st_info bindings in the symbol header
218 ENUM_ST_INFO_BIND
= dict(
230 # st_info type in the symbol header
231 ENUM_ST_INFO_TYPE
= dict(
249 # visibility from st_other
250 ENUM_ST_VISIBILITY
= dict(
259 ENUM_ST_SHNDX
= dict(
301 DT_PREINIT_ARRAYSZ
=33,
305 DT_LOPROC
=0x70000000,
306 DT_HIPROC
=0x7fffffff,
308 DT_VALRNGLO
=0x6ffffd00,
309 DT_GNU_PRELINKED
=0x6ffffdf5,
310 DT_GNU_CONFLICTSZ
=0x6ffffdf6,
311 DT_GNU_LIBLISTSZ
=0x6ffffdf7,
312 DT_CHECKSUM
=0x6ffffdf8,
313 DT_PLTPADSZ
=0x6ffffdf9,
314 DT_MOVEENT
=0x6ffffdfa,
315 DT_MOVESZ
=0x6ffffdfb,
316 DT_SYMINSZ
=0x6ffffdfe,
317 DT_SYMINENT
=0x6ffffdff,
318 DT_GNU_HASH
=0x6ffffef5,
319 DT_TLSDESC_PLT
=0x6ffffef6,
320 DT_TLSDESC_GOT
=0x6ffffef7,
321 DT_GNU_CONFLICT
=0x6ffffef8,
322 DT_GNU_LIBLIST
=0x6ffffef9,
323 DT_CONFIG
=0x6ffffefa,
324 DT_DEPAUDIT
=0x6ffffefb,
326 DT_PLTPAD
=0x6ffffefd,
327 DT_MOVETAB
=0x6ffffefe,
328 DT_SYMINFO
=0x6ffffeff,
329 DT_VERSYM
=0x6ffffff0,
330 DT_RELACOUNT
=0x6ffffff9,
331 DT_RELCOUNT
=0x6ffffffa,
332 DT_FLAGS_1
=0x6ffffffb,
333 DT_VERDEF
=0x6ffffffc,
334 DT_VERDEFNUM
=0x6ffffffd,
335 DT_VERNEED
=0x6ffffffe,
336 DT_VERNEEDNUM
=0x6fffffff,
337 DT_AUXILIARY
=0x7ffffffd,
338 DT_FILTER
=0x7fffffff,
342 ENUM_RELOC_TYPE_i386
= dict(
366 R_386_TLS_GD_PUSH
=25,
367 R_386_TLS_GD_CALL
=26,
370 R_386_TLS_LDM_PUSH
=29,
371 R_386_TLS_LDM_CALL
=30,
372 R_386_TLS_LDM_POP
=31,
376 R_386_TLS_DTPMOD32
=35,
377 R_386_TLS_DTPOFF32
=36,
378 R_386_TLS_TPOFF32
=37,
379 R_386_TLS_GOTDESC
=39,
380 R_386_TLS_DESC_CALL
=40,
383 R_386_USED_BY_INTEL_200
=200,
384 R_386_GNU_VTINHERIT
=250,
385 R_386_GNU_VTENTRY
=251,
389 ENUM_RELOC_TYPE_x64
= dict(
397 R_X86_64_JUMP_SLOT
=7,
406 R_X86_64_DTPMOD64
=16,
407 R_X86_64_DTPOFF64
=17,
411 R_X86_64_DTPOFF32
=21,
412 R_X86_64_GOTTPOFF
=22,
415 R_X86_64_GOTOFF64
=25,
418 R_X86_64_GOTPCREL64
=28,
420 R_X86_64_GOTPLT64
=30,
421 R_X86_64_PLTOFF64
=31,
422 R_X86_64_GOTPC32_TLSDESC
=34,
423 R_X86_64_TLSDESC_CALL
=35,
425 R_X86_64_IRELATIVE
=37,
426 R_X86_64_GNU_VTINHERIT
=250,
427 R_X86_64_GNU_VTENTRY
=251,