LIEF: Library to Instrument Executable Formats Version
Loading...
Searching...
No Matches
Public Member Functions | List of all members
LIEF::ELF::Relocation Class Reference

Class that represents an ELF relocation. More...

#include <Relocation.hpp>

Inheritance diagram for LIEF::ELF::Relocation:
Inheritance graph
[legend]
Collaboration diagram for LIEF::ELF::Relocation:
Collaboration graph
[legend]

Public Member Functions

 Relocation (const details::Elf32_Rel &header)
 
 Relocation (const details::Elf32_Rela &header)
 
 Relocation (const details::Elf64_Rel &header)
 
 Relocation (const details::Elf64_Rela &header)
 
 Relocation (uint64_t address, uint32_t type=0, int64_t addend=0, bool isRela=false)
 
template<class T , typename = typename std::enable_if<std::is_enum<T>::value>::type>
 Relocation (uint64_t address, T type, int64_t addend=0, bool isRela=false)
 
 Relocation (ARCH arch)
 
Relocationoperator= (Relocation other)
 
 Relocation (const Relocation &other)
 
void swap (Relocation &other)
 
int64_t addend () const
 Additional value that can be involved in the relocation processing.
 
uint32_t type () const
 Type of the relocation This type depends on the underlying architecture which can be accessed with architecture().
 
bool is_rela () const
 Check if the relocation uses the explicit addend() field (this is usually the case for 64 bits binaries)
 
bool is_rel () const
 Check if the relocation uses the implicit added (i.e. not present in the ELF structure)
 
uint32_t info () const
 Relocation info which contains for instance the symbol index.
 
ARCH architecture () const
 
RELOCATION_PURPOSES purpose () const
 
size_t size () const override
 Return the size (in bits) of the value associated with this relocation.
 
bool has_symbol () const
 True if the current relocation is associated with a symbol.
 
Symbolsymbol ()
 Symbol associated with the relocation If no symbol is tied to this relocation, it returns a nullptr.
 
const Symbolsymbol () const
 
bool has_section () const
 True if the relocation has an associated section.
 
Sectionsection ()
 The section to which the relocation applies. If no section to which the relocation applies is associtated to this relocation, it returns a nullptr.
 
const Sectionsection () const
 
Sectionsymbol_table ()
 The associated symbol table. If no symbol table section is associated with this relocation, it returns a nullptr.
 
const Sectionsymbol_table () const
 
void addend (int64_t addend)
 
void type (uint32_t type)
 
void purpose (RELOCATION_PURPOSES purpose)
 
void info (uint32_t v)
 
void symbol (Symbol *symbol)
 
void section (Section *section)
 
void symbol_table (Section *section)
 
void accept (Visitor &visitor) const override
 
- Public Member Functions inherited from LIEF::Relocation
 Relocation (uint64_t address, uint8_t size)
 Constructor from a relocation's address and size.
 
Relocationoperator= (const Relocation &)
 
 Relocation (const Relocation &)
 
void swap (Relocation &other)
 
virtual uint64_t address () const
 Relocation's address.
 
virtual void address (uint64_t address)
 
virtual void size (size_t size)
 
void accept (Visitor &visitor) const override
 Method so that the visitor can visit us.
 
virtual bool operator< (const Relocation &rhs) const
 Comparaison based on the Relocation's address
 
virtual bool operator<= (const Relocation &rhs) const
 Comparaison based on the Relocation's address
 
virtual bool operator> (const Relocation &rhs) const
 Comparaison based on the Relocation's address
 
virtual bool operator>= (const Relocation &rhs) const
 Comparaison based on the Relocation's address
 
- Public Member Functions inherited from LIEF::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
 

Additional Inherited Members

- 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 > > >
 

Detailed Description

Class that represents an ELF relocation.

Member Function Documentation

◆ accept()

void LIEF::ELF::Relocation::accept ( Visitor visitor) const
overridevirtual

Implements LIEF::Object.

◆ size()

size_t LIEF::ELF::Relocation::size ( ) const
overridevirtual

Return the size (in bits) of the value associated with this relocation.

Return -1 if it fails

Reimplemented from LIEF::Relocation.

◆ type()

uint32_t LIEF::ELF::Relocation::type ( ) const

Type of the relocation This type depends on the underlying architecture which can be accessed with architecture().

Depending on the architecture, it can return:

  • RELOC_x86_64
  • RELOC_i386
  • RELOC_POWERPC32
  • RELOC_POWERPC64
  • RELOC_AARCH64
  • RELOC_ARM
  • RELOC_MIPS
  • RELOC_HEXAGON
  • RELOC_SYSTEMZ
  • RELOC_SPARC
  • RELOC_LOONGARCH

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