ENUM_D_TAG, ENUM_E_VERSION, ENUM_P_TYPE_BASE, ENUM_SH_TYPE_BASE,
ENUM_RELOC_TYPE_i386, ENUM_RELOC_TYPE_x64,
ENUM_RELOC_TYPE_ARM, ENUM_RELOC_TYPE_AARCH64, ENUM_RELOC_TYPE_MIPS,
- ENUM_ATTR_TAG_ARM)
+ ENUM_ATTR_TAG_ARM, ENUM_DT_FLAGS, ENUM_DT_FLAGS_1)
from .constants import P_FLAGS, SH_FLAGS, SUNW_SYMINFO_FLAGS, VER_FLAGS
from ..common.py3compat import iteritems
return _DESCR_D_TAG.get(x, _unknown)
+def describe_dt_flags(x):
+ return ' '.join(key[3:] for key, val in
+ sorted(ENUM_DT_FLAGS.items(), key=lambda t: t[1]) if x & val)
+
+
+def describe_dt_flags_1(x):
+ return ' '.join(key[5:] for key, val in
+ sorted(ENUM_DT_FLAGS_1.items(), key=lambda t: t[1]) if x & val)
+
+
def describe_syminfo_flags(x):
return ''.join(_DESCR_SYMINFO_FLAGS[flag] for flag in (
SUNW_SYMINFO_FLAGS.SYMINFO_FLG_CAP,
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_MIPS_NONE=0,
R_MIPS_16=1,
describe_sh_type, describe_sh_flags,
describe_symbol_type, describe_symbol_bind, describe_symbol_visibility,
describe_symbol_shndx, describe_reloc_type, describe_dyn_tag,
- describe_ver_flags, describe_note, describe_attr_tag_arm
+ describe_dt_flags, describe_dt_flags_1, describe_ver_flags, describe_note,
+ describe_attr_tag_arm
)
from elftools.elf.constants import E_FLAGS
from elftools.elf.constants import E_FLAGS_MASKS
parsed = 'Library soname: [%s]' % tag.soname
elif tag.entry.d_tag.endswith(('SZ', 'ENT')):
parsed = '%i (bytes)' % tag['d_val']
+ elif tag.entry.d_tag == 'DT_FLAGS':
+ parsed = describe_dt_flags(tag.entry.d_val)
+ elif tag.entry.d_tag == 'DT_FLAGS_1':
+ parsed = 'Flags: %s' % describe_dt_flags_1(tag.entry.d_val)
elif tag.entry.d_tag.endswith(('NUM', 'COUNT')):
parsed = '%i' % tag['d_val']
elif tag.entry.d_tag == 'DT_PLTREL':