ELFOSABI_SORTIX=53,
ELFOSABI_ARM_AEABI=64,
ELFOSABI_ARM=97,
+ ELFOSABI_CELL_LV2=102,
ELFOSABI_STANDALONE=255,
_default_=Pass,
)
EM_MOXIE = 223, # Moxie processor family
EM_AMDGPU = 224, # AMD GPU architecture
EM_RISCV = 243, # RISC-V
+ EM_BPF = 247, # Linux BPF - in-kernel virtual machine
+ EM_CSKY = 252, # C-SKY
+ EM_FRV = 0x5441, # Fujitsu FR-V
# Reservations
# reserved 11-14 Reserved for future use
# reserved 16 Reserved for future use
)
# sh_type in the section header
+#
+# This is the "base" dict that doesn't hold processor-specific values; from it
+# we later create per-processor dicts that use the LOPROC...HIPROC range to
+# define processor-specific values. The proper dict should be used based on the
+# machine the ELF header refers to.
ENUM_SH_TYPE_BASE = dict(
SHT_NULL=0,
SHT_PROGBITS=1,
SHT_PREINIT_ARRAY=16,
SHT_GROUP=17,
SHT_SYMTAB_SHNDX=18,
- SHT_NUM=19,
+ SHT_RELR=19,
+ SHT_NUM=20,
SHT_LOOS=0x60000000,
SHT_GNU_ATTRIBUTES=0x6ffffff5,
SHT_GNU_HASH=0x6ffffff6,
SHT_GNU_verneed=0x6ffffffe, # also SHT_SUNW_verneed
SHT_GNU_versym=0x6fffffff, # also SHT_SUNW_versym, SHT_HIOS
- # These are commented out because they carry no semantic meaning in themselves and
- # may be overridden by target-specific enums.
+ # These are commented out because they carry no semantic meaning in
+ # themselves and may be overridden by target-specific enums.
#SHT_LOPROC=0x70000000,
#SHT_HIPROC=0x7fffffff,
SHT_MIPS_WHIRL=0x70000026,
SHT_MIPS_EH_REGION=0x70000027,
SHT_MIPS_XLATE_OLD=0x70000028,
- SHT_MIPS_PDR_EXCEPTION=0x70000029))
+ SHT_MIPS_PDR_EXCEPTION=0x70000029,
+ SHT_MIPS_ABIFLAGS=0x7000002a))
ENUM_ELFCOMPRESS_TYPE = dict(
ELFCOMPRESS_ZLIB=1,
# p_type in the program header
# some values scavenged from the ELF headers in binutils-2.21
-ENUM_P_TYPE = dict(
+#
+# Using the same base + per-processor augmentation technique as in sh_type.
+ENUM_P_TYPE_BASE = dict(
PT_NULL=0,
PT_LOAD=1,
PT_DYNAMIC=2,
PT_TLS=7,
PT_LOOS=0x60000000,
PT_HIOS=0x6fffffff,
- PT_LOPROC=0x70000000,
- PT_HIPROC=0x7fffffff,
+
+ # These are commented out because they carry no semantic meaning in
+ # themselves and may be overridden by target-specific enums.
+ #PT_LOPROC=0x70000000,
+ #PT_HIPROC=0x7fffffff,
+
PT_GNU_EH_FRAME=0x6474e550,
PT_GNU_STACK=0x6474e551,
PT_GNU_RELRO=0x6474e552,
- PT_ARM_ARCHEXT=0x70000000,
- PT_ARM_EXIDX=0x70000001,
- PT_AARCH64_ARCHEXT=0x70000000,
- PT_AARCH64_UNWIND=0x70000001,
- PT_MIPS_ABIFLAGS=0x70000003,
+ PT_GNU_PROPERTY=0x6474e553,
_default_=Pass,
)
+ENUM_P_TYPE_ARM = merge_dicts(
+ ENUM_P_TYPE_BASE,
+ dict(
+ PT_ARM_ARCHEXT=0x70000000,
+ PT_ARM_EXIDX=0x70000001))
+
+ENUM_P_TYPE_AARCH64 = merge_dicts(
+ ENUM_P_TYPE_BASE,
+ dict(
+ PT_AARCH64_ARCHEXT=0x70000000,
+ PT_AARCH64_UNWIND=0x70000001))
+
+ENUM_P_TYPE_MIPS = merge_dicts(
+ ENUM_P_TYPE_BASE,
+ dict(PT_MIPS_ABIFLAGS=0x70000003))
+
# st_info bindings in the symbol header
ENUM_ST_INFO_BIND = dict(
STB_LOCAL=0,
_default_=Pass,
)
+ENUM_ST_LOCAL = dict(
+ _default_=Pass,
+)
+
# st_shndx
ENUM_ST_SHNDX = dict(
SHN_UNDEF=0,
)
# d_tag
-ENUM_D_TAG = dict(
+ENUM_D_TAG_COMMON = dict(
DT_NULL=0,
DT_NEEDED=1,
DT_PLTRELSZ=2,
DT_ENCODING=32,
DT_PREINIT_ARRAY=32,
DT_PREINIT_ARRAYSZ=33,
- DT_NUM=34,
+ DT_SYMTAB_SHNDX=34,
+ DT_RELRSZ=35,
+ DT_RELR=36,
+ DT_RELRENT=37,
+ DT_NUM=38,
DT_LOOS=0x6000000d,
- DT_SUNW_AUXILIARY=0x6000000d,
- DT_SUNW_RTLDINF=0x6000000e,
- DT_SUNW_FILTER=0x6000000f,
- DT_SUNW_CAP=0x60000010,
- DT_SUNW_SYMTAB=0x60000011,
- DT_SUNW_SYMSZ=0x60000012,
- DT_SUNW_ENCODING=0x60000013,
- DT_SUNW_SORTENT=0x60000013,
- DT_SUNW_SYMSORT=0x60000014,
- DT_SUNW_SYMSORTSZ=0x60000015,
- DT_SUNW_TLSSORT=0x60000016,
- DT_SUNW_TLSSORTSZ=0x60000017,
- DT_SUNW_CAPINFO=0x60000018,
- DT_SUNW_STRPAD=0x60000019,
- DT_SUNW_CAPCHAIN=0x6000001a,
- DT_SUNW_LDMACH=0x6000001b,
- DT_SUNW_CAPCHAINENT=0x6000001d,
- DT_SUNW_CAPCHAINSZ=0x6000001f,
+ DT_ANDROID_REL=0x6000000f,
+ DT_ANDROID_RELSZ=0x60000010,
+ DT_ANDROID_RELA=0x60000011,
+ DT_ANDROID_RELASZ=0x60000012,
+ DT_ANDROID_RELR=0x6fffe000,
+ DT_ANDROID_RELRSZ=0x6fffe001,
+ DT_ANDROID_RELRENT=0x6fffe003,
+ DT_ANDROID_RELRCOUNT=0x6fffe005,
DT_HIOS=0x6ffff000,
DT_LOPROC=0x70000000,
DT_HIPROC=0x7fffffff,
DT_VERDEFNUM=0x6ffffffd,
DT_VERNEED=0x6ffffffe,
DT_VERNEEDNUM=0x6fffffff,
+ DT_AUXILIARY=0x7ffffffd,
+ DT_FILTER=0x7fffffff,
+ _default_=Pass,
+)
+
+# Above are the dynamic tags which are valid always.
+# Below are the dynamic tags which are only valid in certain contexts.
+
+ENUM_D_TAG_SOLARIS = dict(
+ DT_SUNW_AUXILIARY=0x6000000d,
+ DT_SUNW_RTLDINF=0x6000000e,
+ DT_SUNW_FILTER=0x6000000f,
+ DT_SUNW_CAP=0x60000010,
+ DT_SUNW_SYMTAB=0x60000011,
+ DT_SUNW_SYMSZ=0x60000012,
+ DT_SUNW_ENCODING=0x60000013,
+ DT_SUNW_SORTENT=0x60000013,
+ DT_SUNW_SYMSORT=0x60000014,
+ DT_SUNW_SYMSORTSZ=0x60000015,
+ DT_SUNW_TLSSORT=0x60000016,
+ DT_SUNW_TLSSORTSZ=0x60000017,
+ DT_SUNW_CAPINFO=0x60000018,
+ DT_SUNW_STRPAD=0x60000019,
+ DT_SUNW_CAPCHAIN=0x6000001a,
+ DT_SUNW_LDMACH=0x6000001b,
+ DT_SUNW_CAPCHAINENT=0x6000001d,
+ DT_SUNW_CAPCHAINSZ=0x6000001f,
+)
+
+ENUM_D_TAG_MIPS = dict(
DT_MIPS_RLD_VERSION=0x70000001,
DT_MIPS_TIME_STAMP=0x70000002,
DT_MIPS_ICHECKSUM=0x70000003,
DT_MIPS_HIPAGENO=0x70000014,
DT_MIPS_RLD_MAP=0x70000016,
DT_MIPS_RLD_MAP_REL=0x70000035,
- DT_AUXILIARY=0x7ffffffd,
- DT_FILTER=0x7fffffff,
- _default_=Pass,
+)
+
+# Here is the mapping from e_machine enum to the extra dynamic tags which it
+# validates. Solaris is missing from this list because its inclusion is not
+# controlled by e_machine but rather e_ident[EI_OSABI].
+# TODO: add the rest of the machine-specific dynamic tags, not just mips and
+# solaris
+
+ENUMMAP_EXTRA_D_TAG_MACHINE = dict(
+ EM_MIPS=ENUM_D_TAG_MIPS,
+ EM_MIPS_RS3_LE=ENUM_D_TAG_MIPS,
+)
+
+# Here is the full combined mapping from tag name to value
+
+ENUM_D_TAG = dict(ENUM_D_TAG_COMMON)
+ENUM_D_TAG.update(ENUM_D_TAG_SOLARIS)
+for k in ENUMMAP_EXTRA_D_TAG_MACHINE:
+ ENUM_D_TAG.update(ENUMMAP_EXTRA_D_TAG_MACHINE[k])
+
+ENUM_DT_FLAGS = dict(
+ DF_ORIGIN=0x1,
+ DF_SYMBOLIC=0x2,
+ DF_TEXTREL=0x4,
+ DF_BIND_NOW=0x8,
+ DF_STATIC_TLS=0x10,
+)
+
+ENUM_DT_FLAGS_1 = dict(
+ DF_1_NOW=0x1,
+ DF_1_GLOBAL=0x2,
+ DF_1_GROUP=0x4,
+ DF_1_NODELETE=0x8,
+ DF_1_LOADFLTR=0x10,
+ DF_1_INITFIRST=0x20,
+ DF_1_NOOPEN=0x40,
+ DF_1_ORIGIN=0x80,
+ DF_1_DIRECT=0x100,
+ DF_1_TRANS=0x200,
+ DF_1_INTERPOSE=0x400,
+ DF_1_NODEFLIB=0x800,
+ DF_1_NODUMP=0x1000,
+ DF_1_CONFALT=0x2000,
+ DF_1_ENDFILTEE=0x4000,
+ DF_1_DISPRELDNE=0x8000,
+ DF_1_DISPRELPND=0x10000,
+ DF_1_NODIRECT=0x20000,
+ DF_1_IGNMULDEF=0x40000,
+ DF_1_NOKSYMS=0x80000,
+ DF_1_NOHDR=0x100000,
+ DF_1_EDITED=0x200000,
+ DF_1_NORELOC=0x400000,
+ DF_1_SYMINTPOSE=0x800000,
+ DF_1_GLOBAUDIT=0x1000000,
+ DF_1_SINGLETON=0x2000000,
+ DF_1_STUB=0x4000000,
+ DF_1_PIE=0x8000000,
)
ENUM_RELOC_TYPE_MIPS = dict(
R_X86_64_TLSDESC_CALL=35,
R_X86_64_TLSDESC=36,
R_X86_64_IRELATIVE=37,
+ R_X86_64_REX_GOTPCRELX=42,
R_X86_64_GNU_VTINHERIT=250,
R_X86_64_GNU_VTENTRY=251,
_default_=Pass,
NT_GNU_HWCAP=2,
NT_GNU_BUILD_ID=3,
NT_GNU_GOLD_VERSION=4,
+ NT_GNU_PROPERTY_TYPE_0=5,
_default_=Pass,
)
_default_=Pass,
)
+# Values in GNU .note.gnu.property notes (n_type=='NT_GNU_PROPERTY_TYPE_0')
+ENUM_NOTE_GNU_PROPERTY_TYPE = dict(
+ GNU_PROPERTY_STACK_SIZE=1,
+ GNU_PROPERTY_NO_COPY_ON_PROTECTED=2,
+ GNU_PROPERTY_X86_FEATURE_1_AND=0xc0000002,
+ GNU_PROPERTY_X86_ISA_1_NEEDED=0xc0008002,
+ _default_=Pass,
+)
+
+ENUM_GNU_PROPERTY_X86_FEATURE_1_FLAGS = dict(
+ GNU_PROPERTY_X86_FEATURE_1_IBT=1,
+ GNU_PROPERTY_X86_FEATURE_1_SHSTK=2,
+ GNU_PROPERTY_X86_FEATURE_1_LAM_U48=4,
+ GNU_PROPERTY_X86_FEATURE_1_LAM_U57=8,
+ _default_=Pass
+)
+
ENUM_RELOC_TYPE_ARM = dict(
R_ARM_NONE=0,
R_ARM_PC24=1,
TAG_VIRTUALIZATION_USE=68,
TAG_MPEXTENSION_USE_OLD=70,
)
+
+# https://openpowerfoundation.org/wp-content/uploads/2016/03/ABI64BitOpenPOWERv1.1_16July2015_pub4.pdf
+# See 3.5.3 Relocation Types Table.
+ENUM_RELOC_TYPE_PPC64 = dict(
+ R_PPC64_NONE=0,
+ R_PPC64_ADDR32=1,
+ R_PPC64_ADDR24=2,
+ R_PPC64_ADDR16=3,
+ R_PPC64_ADDR16_LO=4,
+ R_PPC64_ADDR16_HI=5,
+ R_PPC64_ADDR16_HA=6,
+ R_PPC64_ADDR14=7,
+ R_PPC64_ADDR14_BRTAKEN=8,
+ R_PPC64_ADDR14_BRNTAKEN=9,
+ R_PPC64_REL24=10,
+ R_PPC64_REL14=11,
+ R_PPC64_REL14_BRTAKEN=12,
+ R_PPC64_REL14_BRNTAKEN=13,
+ R_PPC64_GOT16=14,
+ R_PPC64_GOT16_LO=15,
+ R_PPC64_GOT16_HI=16,
+ R_PPC64_GOT16_HA=17,
+ R_PPC64_COPY=19,
+ R_PPC64_GLOB_DAT=20,
+ R_PPC64_JMP_SLOT=21,
+ R_PPC64_RELATIVE=22,
+ R_PPC64_UADDR32=24,
+ R_PPC64_UADDR16=25,
+ R_PPC64_REL32=26,
+ R_PPC64_PLT32=27,
+ R_PPC64_PLTREL32=28,
+ R_PPC64_PLT16_LO=29,
+ R_PPC64_PLT16_HI=30,
+ R_PPC64_PLT16_HA=31,
+ R_PPC64_SECTOFF=33,
+ R_PPC64_SECTOFF_LO=34,
+ R_PPC64_SECTOFF_HI=35,
+ R_PPC64_SECTOFF_HA=36,
+ R_PPC64_ADDR30=37,
+ R_PPC64_ADDR64=38,
+ R_PPC64_ADDR16_HIGHER=39,
+ R_PPC64_ADDR16_HIGHERA=40,
+ R_PPC64_ADDR16_HIGHEST=41,
+ R_PPC64_ADDR16_HIGHESTA=42,
+ R_PPC64_UADDR64=43,
+ R_PPC64_REL64=44,
+ R_PPC64_PLT64=45,
+ R_PPC64_PLTREL64=46,
+ R_PPC64_TOC16=47,
+ R_PPC64_TOC16_LO=48,
+ R_PPC64_TOC16_HI=49,
+ R_PPC64_TOC16_HA=50,
+ R_PPC64_TOC=51,
+ R_PPC64_PLTGOT16=52,
+ R_PPC64_PLTGOT16_LO=53,
+ R_PPC64_PLTGOT16_HI=54,
+ R_PPC64_PLTGOT16_HA=55,
+ R_PPC64_ADDR16_DS=56,
+ R_PPC64_ADDR16_LO_DS=57,
+ R_PPC64_GOT16_DS=58,
+ R_PPC64_GOT16_LO_DS=59,
+ R_PPC64_PLT16_LO_DS=60,
+ R_PPC64_SECTOFF_DS=61,
+ R_PPC64_SECTOFF_LO_DS=62,
+ R_PPC64_TOC16_DS=63,
+ R_PPC64_TOC16_LO_DS=64,
+ R_PPC64_PLTGOT16_DS=65,
+ R_PPC64_PLTGOT16_LO_DS=66,
+ R_PPC64_TLS=67,
+ R_PPC64_DTPMOD64=68,
+ R_PPC64_TPREL16=69,
+ R_PPC64_TPREL16_LO=70,
+ R_PPC64_TPREL16_HI=71,
+ R_PPC64_TPREL16_HA=72,
+ R_PPC64_TPREL64=73,
+ R_PPC64_DTPREL16=74,
+ R_PPC64_DTPREL16_LO=75,
+ R_PPC64_DTPREL16_HI=76,
+ R_PPC64_DTPREL16_HA=77,
+ R_PPC64_DTPREL64=78,
+ R_PPC64_GOT_TLSGD16=79,
+ R_PPC64_GOT_TLSGD16_LO=80,
+ R_PPC64_GOT_TLSGD16_HI=81,
+ R_PPC64_GOT_TLSGD16_HA=82,
+ R_PPC64_GOT_TLSLD16=83,
+ R_PPC64_GOT_TLSLD16_LO=84,
+ R_PPC64_GOT_TLSLD16_HI=85,
+ R_PPC64_GOT_TLSLD16_HA=86,
+ R_PPC64_GOT_TPREL16_DS=87,
+ R_PPC64_GOT_TPREL16_LO_DS=88,
+ R_PPC64_GOT_TPREL16_HI=89,
+ R_PPC64_GOT_TPREL16_HA=90,
+ R_PPC64_GOT_DTPREL16_DS=91,
+ R_PPC64_GOT_DTPREL16_LO_DS=92,
+ R_PPC64_GOT_DTPREL16_HI=93,
+ R_PPC64_GOT_DTPREL16_HA=94,
+ R_PPC64_TPREL16_DS=95,
+ R_PPC64_TPREL16_LO_DS=96,
+ R_PPC64_TPREL16_HIGHER=97,
+ R_PPC64_TPREL16_HIGHERA=98,
+ R_PPC64_TPREL16_HIGHEST=99,
+ R_PPC64_TPREL16_HIGHESTA=100,
+ R_PPC64_DTPREL16_DS=101,
+ R_PPC64_DTPREL16_LO_DS=102,
+ R_PPC64_DTPREL16_HIGHER=103,
+ R_PPC64_DTPREL16_HIGHERA=104,
+ R_PPC64_DTPREL16_HIGHEST=105,
+ R_PPC64_DTPREL16_HIGHESTA=106,
+ R_PPC64_TLSGD=107,
+ R_PPC64_TLSLD=108,
+ R_PPC64_TOCSAVE=109,
+ R_PPC64_ADDR16_HIGH=110,
+ R_PPC64_ADDR16_HIGHA=111,
+ R_PPC64_TPREL16_HIGH=112,
+ R_PPC64_TPREL16_HIGHA=113,
+ R_PPC64_DTPREL16_HIGH=114,
+ R_PPC64_DTPREL16_HIGHA=115,
+ R_PPC64_REL24_NOTOC=116,
+ R_PPC64_ADDR64_LOCAL=117,
+ R_PPC64_IRELATIVE=248,
+ R_PPC64_REL16=249,
+ R_PPC64_REL16_LO=250,
+ R_PPC64_REL16_HI=251,
+ R_PPC64_REL16_HA=252,
+ R_PPC64_GNU_VTINHERIT=253,
+ R_PPC64_GNU_VTENTRY=254,
+)