LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
LIEF::ELF::DynamicEntry Class Reference

Class which represents an entry in the dynamic table These entries are located in the .dynamic section or the PT_DYNAMIC segment. More...

#include <DynamicEntry.hpp>

Inheritance diagram for LIEF::ELF::DynamicEntry:
Collaboration diagram for LIEF::ELF::DynamicEntry:

Public Types

enum class  TAG : uint64_t {
  UNKNOWN = uint64_t(-1) , DT_NULL_ = 0 , NEEDED = 1 , PLTRELSZ = 2 ,
  PLTGOT = 3 , HASH = 4 , STRTAB = 5 , SYMTAB = 6 ,
  RELA = 7 , RELASZ = 8 , RELAENT = 9 , STRSZ = 10 ,
  SYMENT = 11 , INIT = 12 , FINI = 13 , SONAME = 14 ,
  RPATH = 15 , SYMBOLIC = 16 , REL = 17 , RELSZ = 18 ,
  RELENT = 19 , PLTREL = 20 , DEBUG_TAG = 21 , TEXTREL = 22 ,
  JMPREL = 23 , BIND_NOW = 24 , INIT_ARRAY = 25 , FINI_ARRAY = 26 ,
  INIT_ARRAYSZ = 27 , FINI_ARRAYSZ = 28 , RUNPATH = 29 , FLAGS = 30 ,
  PREINIT_ARRAY = 32 , PREINIT_ARRAYSZ = 33 , SYMTAB_SHNDX = 34 , RELRSZ = 35 ,
  RELR = 36 , RELRENT = 37 , GNU_HASH = 0x6FFFFEF5 , RELACOUNT = 0x6FFFFFF9 ,
  RELCOUNT = 0x6FFFFFFA , FLAGS_1 = 0x6FFFFFFB , VERSYM = 0x6FFFFFF0 , VERDEF = 0x6FFFFFFC ,
  VERDEFNUM = 0x6FFFFFFD , VERNEED = 0x6FFFFFFE , VERNEEDNUM = 0x6FFFFFFF , ANDROID_REL_OFFSET = 0x6000000D ,
  ANDROID_REL_SIZE = 0x6000000E , ANDROID_REL = 0x6000000F , ANDROID_RELSZ = 0x60000010 , ANDROID_RELA = 0x60000011 ,
  ANDROID_RELASZ = 0x60000012 , ANDROID_RELR = 0x6FFFE000 , ANDROID_RELRSZ = 0x6FFFE001 , ANDROID_RELRENT = 0x6FFFE003 ,
  ANDROID_RELRCOUNT = 0x6FFFE005 , MIPS_RLD_VERSION = MIPS_DISC + 0x70000001 , MIPS_TIME_STAMP = MIPS_DISC + 0x70000002 , MIPS_ICHECKSUM = MIPS_DISC + 0x70000003 ,
  MIPS_IVERSION = MIPS_DISC + 0x70000004 , MIPS_FLAGS = MIPS_DISC + 0x70000005 , MIPS_BASE_ADDRESS = MIPS_DISC + 0x70000006 , MIPS_MSYM = MIPS_DISC + 0x70000007 ,
  MIPS_CONFLICT = MIPS_DISC + 0x70000008 , MIPS_LIBLIST = MIPS_DISC + 0x70000009 , MIPS_LOCAL_GOTNO = MIPS_DISC + 0x7000000a , MIPS_CONFLICTNO = MIPS_DISC + 0x7000000b ,
  MIPS_LIBLISTNO = MIPS_DISC + 0x70000010 , MIPS_SYMTABNO = MIPS_DISC + 0x70000011 , MIPS_UNREFEXTNO = MIPS_DISC + 0x70000012 , MIPS_GOTSYM = MIPS_DISC + 0x70000013 ,
  MIPS_HIPAGENO = MIPS_DISC + 0x70000014 , MIPS_RLD_MAP = MIPS_DISC + 0x70000016 , MIPS_DELTA_CLASS = MIPS_DISC + 0x70000017 , MIPS_DELTA_CLASS_NO = MIPS_DISC + 0x70000018 ,
  MIPS_DELTA_INSTANCE = MIPS_DISC + 0x70000019 , MIPS_DELTA_INSTANCE_NO = MIPS_DISC + 0x7000001A , MIPS_DELTA_RELOC = MIPS_DISC + 0x7000001B , MIPS_DELTA_RELOC_NO = MIPS_DISC + 0x7000001C ,
  MIPS_DELTA_SYM = MIPS_DISC + 0x7000001D , MIPS_DELTA_SYM_NO = MIPS_DISC + 0x7000001E , MIPS_DELTA_CLASSSYM = MIPS_DISC + 0x70000020 , MIPS_DELTA_CLASSSYM_NO = MIPS_DISC + 0x70000021 ,
  MIPS_CXX_FLAGS = MIPS_DISC + 0x70000022 , MIPS_PIXIE_INIT = MIPS_DISC + 0x70000023 , MIPS_SYMBOL_LIB = MIPS_DISC + 0x70000024 , MIPS_LOCALPAGE_GOTIDX = MIPS_DISC + 0x70000025 ,
  MIPS_LOCAL_GOTIDX = MIPS_DISC + 0x70000026 , MIPS_HIDDEN_GOTIDX = MIPS_DISC + 0x70000027 , MIPS_PROTECTED_GOTIDX = MIPS_DISC + 0x70000028 , MIPS_OPTIONS = MIPS_DISC + 0x70000029 ,
  MIPS_DYNSTR_ALIGN = MIPS_DISC + 0x7000002B , MIPS_INTERFACE_SIZE = MIPS_DISC + 0x7000002C , MIPS_RLD_TEXT_RESOLVE_ADDR = MIPS_DISC + 0x7000002D , MIPS_PERF_SUFFIX = MIPS_DISC + 0x7000002E ,
  MIPS_COMPACT_SIZE = MIPS_DISC + 0x7000002F , MIPS_GP_VALUE = MIPS_DISC + 0x70000030 , MIPS_AUX_DYNAMIC = MIPS_DISC + 0x70000031 , MIPS_PLTGOT = MIPS_DISC + 0x70000032 ,
  MIPS_RWPLT = MIPS_DISC + 0x70000034 , MIPS_RLD_MAP_REL = MIPS_DISC + 0x70000035 , MIPS_XHASH = MIPS_DISC + 0x70000036 , AARCH64_BTI_PLT = AARCH64_DISC + 0x70000001 ,
  AARCH64_PAC_PLT = AARCH64_DISC + 0x70000003 , AARCH64_VARIANT_PCS = AARCH64_DISC + 0x70000005 , AARCH64_MEMTAG_MODE = AARCH64_DISC + 0x70000009 , AARCH64_MEMTAG_HEAP = AARCH64_DISC + 0x7000000b ,
  AARCH64_MEMTAG_STACK = AARCH64_DISC + 0x7000000c , AARCH64_MEMTAG_GLOBALS = AARCH64_DISC + 0x7000000d , AARCH64_MEMTAG_GLOBALSSZ = AARCH64_DISC + 0x7000000f , HEXAGON_SYMSZ = HEXAGON_DISC + 0x70000000 ,
  HEXAGON_VER = HEXAGON_DISC + 0x70000001 , HEXAGON_PLT = HEXAGON_DISC + 0x70000002 , PPC_GOT = PPC_DISC + 0x70000000 , PPC_OPT = PPC_DISC + 0x70000001 ,
  PPC64_GLINK = PPC64_DISC + 0x70000000 , PPC64_OPT = PPC64_DISC + 0x70000003 , RISCV_VARIANT_CC = RISCV_DISC + 0x70000003 , X86_64_PLT = X86_64_DISC + 0x70000000 ,
  X86_64_PLTSZ = X86_64_DISC + 0x70000001 , X86_64_PLTENT = X86_64_DISC + 0x70000003
}
 
- Public Types inherited from LIEF::Object
template<class T >
using output_t = add_pointer_t<decay_t<T>>
 
template<class T >
using output_const_t = add_pointer_t<add_const_t<decay_t<T>>>
 

Public Member Functions

 DynamicEntry ()=default
 
 DynamicEntry (const details::Elf64_Dyn &header, ARCH arch)
 
 DynamicEntry (const details::Elf32_Dyn &header, ARCH arch)
 
 DynamicEntry (TAG tag, uint64_t value)
 
DynamicEntryoperator= (const DynamicEntry &)=default
 
 DynamicEntry (const DynamicEntry &)=default
 
 ~DynamicEntry () override=default
 
virtual std::unique_ptr< DynamicEntryclone () const
 
TAG tag () const
 Tag of the current entry. The most common tags are: DT_NEEDED, DT_INIT, ...
 
uint64_t value () const
 Return the entry's value.
 
void tag (TAG tag)
 
void value (uint64_t value)
 
void accept (Visitor &visitor) const override
 
virtual std::ostream & print (std::ostream &os) const
 
template<class T >
const T * cast () const
 
template<class T >
T * cast ()
 
- Public Member Functions inherited from LIEF::Object
 Object ()
 
 Object (const Object &other)
 
Objectoperator= (const Object &other)
 
template<class T >
output_t< T > as ()
 
template<class T >
output_const_t< T > as () const
 
virtual bool operator== (const Object &other) const
 
virtual bool operator!= (const Object &other) const
 
virtual ~Object ()
 

Static Public Member Functions

static TAG from_value (uint64_t value, ARCH arch)
 
static uint64_t to_value (TAG tag)
 

Static Public Attributes

static constexpr uint64_t MIPS_DISC = 0x100000000
 
static constexpr uint64_t AARCH64_DISC = 0x200000000
 
static constexpr uint64_t HEXAGON_DISC = 0x300000000
 
static constexpr uint64_t PPC_DISC = 0x400000000
 
static constexpr uint64_t PPC64_DISC = 0x500000000
 
static constexpr uint64_t RISCV_DISC = 0x600000000
 
static constexpr uint64_t X86_64_DISC = 0x700000000
 

Detailed Description

Class which represents an entry in the dynamic table These entries are located in the .dynamic section or the PT_DYNAMIC segment.

Member Enumeration Documentation

◆ TAG

enum class LIEF::ELF::DynamicEntry::TAG : uint64_t
strong
Enumerator
UNKNOWN 
DT_NULL_ 

Marks end of dynamic array.

NEEDED 

String table offset of needed library.

PLTRELSZ 

Size of relocation entries in PLT.

PLTGOT 

Address associated with linkage table.

HASH 

Address of symbolic hash table.

STRTAB 

Address of dynamic string table.

SYMTAB 

Address of dynamic symbol table.

RELA 

Address of relocation table (Rela entries).

RELASZ 

Size of Rela relocation table.

RELAENT 

Size of a Rela relocation entry.

STRSZ 

Total size of the string table.

SYMENT 

Size of a symbol table entry.

INIT 

Address of initialization function.

FINI 

Address of termination function.

SONAME 

String table offset of a shared objects name.

RPATH 

String table offset of library search path.

SYMBOLIC 

Changes symbol resolution algorithm.

REL 

Address of relocation table (Rel entries).

RELSZ 

Size of Rel relocation table.

RELENT 

Size of a Rel relocation entry.

PLTREL 

Type of relocation entry used for linking.

DEBUG_TAG 

Reserved for debugger.

TEXTREL 

Relocations exist for non-writable segments.

JMPREL 

Address of relocations associated with PLT.

BIND_NOW 

Process all relocations before execution.

INIT_ARRAY 

Pointer to array of initialization functions.

FINI_ARRAY 

Pointer to array of termination functions.

INIT_ARRAYSZ 

Size of DT_INIT_ARRAY.

FINI_ARRAYSZ 

Size of DT_FINI_ARRAY.

RUNPATH 

String table offset of lib search path.

FLAGS 

Flags.

PREINIT_ARRAY 

Pointer to array of preinit functions.

PREINIT_ARRAYSZ 

Size of the DT_PREINIT_ARRAY array.

SYMTAB_SHNDX 

Address of SYMTAB_SHNDX section

RELRSZ 

Total size of RELR relative relocations

RELR 

Address of RELR relative relocations

RELRENT 

Size of one RELR relative relocaction

GNU_HASH 

Reference to the GNU hash table.

RELACOUNT 

ELF32_Rela count.

RELCOUNT 

ELF32_Rel count.

FLAGS_1 

Flags_1.

VERSYM 

The address of .gnu.version section.

VERDEF 

The address of the version definition table.

VERDEFNUM 

The number of entries in DT_VERDEF.

VERNEED 

The address of the version Dependency table.

VERNEEDNUM 

The number of entries in DT_VERNEED.

ANDROID_REL_OFFSET 

The offset of packed relocation data (older version < M) (Android specific).

ANDROID_REL_SIZE 

The size of packed relocation data in bytes (older version < M) (Android specific).

ANDROID_REL 

The offset of packed relocation data (Android specific).

ANDROID_RELSZ 

The size of packed relocation data in bytes (Android specific).

ANDROID_RELA 

The offset of packed relocation data (Android specific).

ANDROID_RELASZ 

The size of packed relocation data in bytes (Android specific).

ANDROID_RELR 

The offset of new relr relocation data (Android specific).

ANDROID_RELRSZ 

The size of nre relr relocation data in bytes (Android specific).

ANDROID_RELRENT 

The size of a new relr relocation entry (Android specific).

ANDROID_RELRCOUNT 

Specifies the relative count of new relr relocation entries (Android specific).

MIPS_RLD_VERSION 

32 bit version number for runtime linker interface.

MIPS_TIME_STAMP 

Time stamp.

MIPS_ICHECKSUM 

Checksum of external strings and common sizes.

MIPS_IVERSION 

Index of version string in string table.

MIPS_FLAGS 

32 bits of flags.

MIPS_BASE_ADDRESS 

Base address of the segment.

MIPS_MSYM 

Address of .msym section.

MIPS_CONFLICT 

Address of .conflict section.

MIPS_LIBLIST 

Address of .liblist section.

MIPS_LOCAL_GOTNO 

Number of local global offset table entries.

MIPS_CONFLICTNO 

Number of entries in the .conflict section.

MIPS_LIBLISTNO 

Number of entries in the .liblist section.

MIPS_SYMTABNO 

Number of entries in the .dynsym section.

MIPS_UNREFEXTNO 

Index of first external dynamic symbol not referenced locally.

MIPS_GOTSYM 

Index of first dynamic symbol in global offset table.

MIPS_HIPAGENO 

Number of page table entries in global offset table.

MIPS_RLD_MAP 

Address of run time loader map, used for debugging.

MIPS_DELTA_CLASS 

Delta C++ class definition.

MIPS_DELTA_CLASS_NO 

Number of entries in DT_MIPS_DELTA_CLASS.

MIPS_DELTA_INSTANCE 

Delta C++ class instances.

MIPS_DELTA_INSTANCE_NO 

Number of entries in DT_MIPS_DELTA_INSTANCE.

MIPS_DELTA_RELOC 

Delta relocations.

MIPS_DELTA_RELOC_NO 

Number of entries in DT_MIPS_DELTA_RELOC.

MIPS_DELTA_SYM 

Delta symbols that Delta relocations refer to.

MIPS_DELTA_SYM_NO 

Number of entries in DT_MIPS_DELTA_SYM.

MIPS_DELTA_CLASSSYM 

Delta symbols that hold class declarations.

MIPS_DELTA_CLASSSYM_NO 

Number of entries in DT_MIPS_DELTA_CLASSSYM.

MIPS_CXX_FLAGS 

Flags indicating information about C++ flavor.

MIPS_PIXIE_INIT 

Pixie information.

MIPS_SYMBOL_LIB 

Address of .MIPS.symlib

MIPS_LOCALPAGE_GOTIDX 

The GOT index of the first PTE for a segment

MIPS_LOCAL_GOTIDX 

The GOT index of the first PTE for a local symbol

MIPS_HIDDEN_GOTIDX 

The GOT index of the first PTE for a hidden symbol

MIPS_PROTECTED_GOTIDX 

The GOT index of the first PTE for a protected symbol

MIPS_OPTIONS 

Address of ‘.MIPS.options’. *‍/ MIPS_INTERFACE = MIPS_DISC + 0x7000002A, /**< Address of ‘.interface’.

MIPS_DYNSTR_ALIGN 

Unknown.

MIPS_INTERFACE_SIZE 

Size of the .interface section.

MIPS_RLD_TEXT_RESOLVE_ADDR 

Size of rld_text_resolve function stored in the GOT.

MIPS_PERF_SUFFIX 

Default suffix of DSO to be added by rld on dlopen() calls.

MIPS_COMPACT_SIZE 

Size of compact relocation section (O32).

MIPS_GP_VALUE 

GP value for auxiliary GOTs.

MIPS_AUX_DYNAMIC 

Address of auxiliary .dynamic.

MIPS_PLTGOT 

Address of the base of the PLTGOT.

MIPS_RWPLT 
MIPS_RLD_MAP_REL 
MIPS_XHASH 
AARCH64_BTI_PLT 
AARCH64_PAC_PLT 
AARCH64_VARIANT_PCS 
AARCH64_MEMTAG_MODE 
AARCH64_MEMTAG_HEAP 
AARCH64_MEMTAG_STACK 
AARCH64_MEMTAG_GLOBALS 
AARCH64_MEMTAG_GLOBALSSZ 
HEXAGON_SYMSZ 
HEXAGON_VER 
HEXAGON_PLT 
PPC_GOT 
PPC_OPT 
PPC64_GLINK 
PPC64_OPT 
RISCV_VARIANT_CC 
X86_64_PLT 
X86_64_PLTSZ 
X86_64_PLTENT 

Constructor & Destructor Documentation

◆ DynamicEntry() [1/5]

LIEF::ELF::DynamicEntry::DynamicEntry ( )
default

◆ DynamicEntry() [2/5]

LIEF::ELF::DynamicEntry::DynamicEntry ( const details::Elf64_Dyn & header,
ARCH arch )

◆ DynamicEntry() [3/5]

LIEF::ELF::DynamicEntry::DynamicEntry ( const details::Elf32_Dyn & header,
ARCH arch )

◆ DynamicEntry() [4/5]

LIEF::ELF::DynamicEntry::DynamicEntry ( TAG tag,
uint64_t value )
inline

◆ DynamicEntry() [5/5]

LIEF::ELF::DynamicEntry::DynamicEntry ( const DynamicEntry & )
default

◆ ~DynamicEntry()

LIEF::ELF::DynamicEntry::~DynamicEntry ( )
overridedefault

Member Function Documentation

◆ accept()

◆ cast() [1/2]

template<class T >
T * LIEF::ELF::DynamicEntry::cast ( )
inline

◆ cast() [2/2]

template<class T >
const T * LIEF::ELF::DynamicEntry::cast ( ) const
inline

◆ clone()

◆ from_value()

static TAG LIEF::ELF::DynamicEntry::from_value ( uint64_t value,
ARCH arch )
static

◆ operator=()

DynamicEntry & LIEF::ELF::DynamicEntry::operator= ( const DynamicEntry & )
default

◆ print()

virtual std::ostream & LIEF::ELF::DynamicEntry::print ( std::ostream & os) const
virtual

◆ tag() [1/2]

◆ tag() [2/2]

void LIEF::ELF::DynamicEntry::tag ( TAG tag)
inline

◆ to_value()

static uint64_t LIEF::ELF::DynamicEntry::to_value ( TAG tag)
static

◆ value() [1/2]

uint64_t LIEF::ELF::DynamicEntry::value ( ) const
inline

Return the entry's value.

The meaning of the value strongly depends on the tag. It can be an offset, an index, a flag, ...

◆ value() [2/2]

void LIEF::ELF::DynamicEntry::value ( uint64_t value)
inline

Member Data Documentation

◆ AARCH64_DISC

uint64_t LIEF::ELF::DynamicEntry::AARCH64_DISC = 0x200000000
staticconstexpr

◆ HEXAGON_DISC

uint64_t LIEF::ELF::DynamicEntry::HEXAGON_DISC = 0x300000000
staticconstexpr

◆ MIPS_DISC

uint64_t LIEF::ELF::DynamicEntry::MIPS_DISC = 0x100000000
staticconstexpr

◆ PPC64_DISC

uint64_t LIEF::ELF::DynamicEntry::PPC64_DISC = 0x500000000
staticconstexpr

◆ PPC_DISC

uint64_t LIEF::ELF::DynamicEntry::PPC_DISC = 0x400000000
staticconstexpr

◆ RISCV_DISC

uint64_t LIEF::ELF::DynamicEntry::RISCV_DISC = 0x600000000
staticconstexpr

◆ X86_64_DISC

uint64_t LIEF::ELF::DynamicEntry::X86_64_DISC = 0x700000000
staticconstexpr

The documentation for this class was generated from the following file: