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

Class which represents an entry of the PE relocation table. More...

#include <RelocationEntry.hpp>

Inheritance diagram for LIEF::PE::RelocationEntry:
Collaboration diagram for LIEF::PE::RelocationEntry:

Public Types

enum class  BASE_TYPES {
  UNKNOWN = -1 , ABS = 0 , HIGH = 1 , LOW = 2 ,
  HIGHLOW = 3 , HIGHADJ = 4 , MIPS_JMPADDR = 5 , ARM_MOV32A = 5 + 0x101 ,
  ARM_MOV32 = 5 + 0x102 , RISCV_HI20 = 5 + 0x103 , SECTION = 6 , REL = 7 ,
  ARM_MOV32T = 7 + 0x201 , THUMB_MOV32 = 7 + 0x202 , RISCV_LOW12I = 7 + 0x203 , RISCV_LOW12S = 8 ,
  IA64_IMM64 = 9 , MIPS_JMPADDR16 = 9 + 0x300 , DIR64 = 10 , HIGH3ADJ = 11
}
 
- 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

 RelocationEntry ()=default
 
 RelocationEntry (const RelocationEntry &other)
 
RelocationEntryoperator= (RelocationEntry other)
 
 RelocationEntry (uint16_t position, BASE_TYPES type)
 
 ~RelocationEntry () override=default
 
void swap (RelocationEntry &other)
 
uint64_t address () const override
 The address of the relocation.
 
void address (uint64_t address) override
 
size_t size () const override
 The size of the relocatable pointer.
 
void size (size_t size) override
 
uint16_t data () const
 Raw data of the relocation:
 
uint16_t position () const
 Offset relative to Relocation::virtual_address where the relocation occurs.
 
BASE_TYPES type () const
 Type of the relocation.
 
void data (uint16_t data)
 
void position (uint16_t position)
 
void type (BASE_TYPES type)
 
void accept (Visitor &visitor) const override
 Method so that the visitor can visit us.
 
- Public Member Functions inherited from LIEF::Relocation
 Relocation ()=default
 
 Relocation (uint64_t address, uint8_t size)
 Constructor from a relocation's address and size.
 
 ~Relocation () override=default
 
Relocationoperator= (const Relocation &)=default
 
 Relocation (const Relocation &)=default
 
void swap (Relocation &other)
 
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 ()
 
 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 RelocationEntry from_raw (Header::MACHINE_TYPES arch, uint16_t raw)
 

Detailed Description

Class which represents an entry of the PE relocation table.

It extends the LIEF::Relocation object to provide an uniform API across the file formats

Member Enumeration Documentation

◆ BASE_TYPES

Enumerator
UNKNOWN 
ABS 
HIGH 
LOW 
HIGHLOW 
HIGHADJ 
MIPS_JMPADDR 
ARM_MOV32A 
ARM_MOV32 
RISCV_HI20 
SECTION 
REL 
ARM_MOV32T 
THUMB_MOV32 
RISCV_LOW12I 
RISCV_LOW12S 
IA64_IMM64 
MIPS_JMPADDR16 
DIR64 
HIGH3ADJ 

Constructor & Destructor Documentation

◆ RelocationEntry() [1/3]

LIEF::PE::RelocationEntry::RelocationEntry ( )
default

◆ RelocationEntry() [2/3]

LIEF::PE::RelocationEntry::RelocationEntry ( const RelocationEntry & other)

◆ RelocationEntry() [3/3]

LIEF::PE::RelocationEntry::RelocationEntry ( uint16_t position,
BASE_TYPES type )

◆ ~RelocationEntry()

LIEF::PE::RelocationEntry::~RelocationEntry ( )
overridedefault

Member Function Documentation

◆ accept()

void LIEF::PE::RelocationEntry::accept ( Visitor & visitor) const
overridevirtual

Method so that the visitor can visit us.

Reimplemented from LIEF::Relocation.

◆ address() [1/2]

uint64_t LIEF::PE::RelocationEntry::address ( ) const
overridevirtual

The address of the relocation.

Reimplemented from LIEF::Relocation.

◆ address() [2/2]

void LIEF::PE::RelocationEntry::address ( uint64_t address)
overridevirtual

Reimplemented from LIEF::Relocation.

◆ data() [1/2]

uint16_t LIEF::PE::RelocationEntry::data ( ) const

Raw data of the relocation:

  • The high 4 bits store the relocation type
  • The low 12 bits store the relocation offset

◆ data() [2/2]

void LIEF::PE::RelocationEntry::data ( uint16_t data)

◆ from_raw()

static RelocationEntry LIEF::PE::RelocationEntry::from_raw ( Header::MACHINE_TYPES arch,
uint16_t raw )
inlinestatic

◆ operator=()

RelocationEntry & LIEF::PE::RelocationEntry::operator= ( RelocationEntry other)

◆ position() [1/2]

uint16_t LIEF::PE::RelocationEntry::position ( ) const
inline

Offset relative to Relocation::virtual_address where the relocation occurs.

◆ position() [2/2]

void LIEF::PE::RelocationEntry::position ( uint16_t position)
inline

◆ size() [1/2]

size_t LIEF::PE::RelocationEntry::size ( ) const
overridevirtual

The size of the relocatable pointer.

Reimplemented from LIEF::Relocation.

◆ size() [2/2]

void LIEF::PE::RelocationEntry::size ( size_t size)
overridevirtual

Reimplemented from LIEF::Relocation.

◆ swap()

void LIEF::PE::RelocationEntry::swap ( RelocationEntry & other)

◆ type() [1/2]

BASE_TYPES LIEF::PE::RelocationEntry::type ( ) const
inline

Type of the relocation.

◆ type() [2/2]

void LIEF::PE::RelocationEntry::type ( BASE_TYPES type)
inline

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