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

Class that represents a relocation presents in the MachO object file (.o). Usually, this kind of relocation is found in the MachO::Section. More...

#include <RelocationObject.hpp>

Inheritance diagram for LIEF::MachO::RelocationObject:
Collaboration diagram for LIEF::MachO::RelocationObject:

Public Member Functions

 RelocationObject ()=default
 
 RelocationObject (const details::relocation_info &relocinfo)
 
 RelocationObject (const details::scattered_relocation_info &scattered_relocinfo)
 
RelocationObjectoperator= (const RelocationObject &other)=default
 
 RelocationObject (const RelocationObject &other)=default
 
void swap (RelocationObject &other) noexcept
 
 ~RelocationObject () override=default
 
std::unique_ptr< Relocationclone () const override
 
bool is_pc_relative () const override
 Whether the relocation is PC relative.
 
size_t size () const override
 Size of the relocation.
 
uint64_t address () const override
 Address where the relocation is applied This address is relative to the start of the section where the relocation takes place.
 
bool is_scattered () const
 true if the relocation is a scattered one
 
int32_t value () const
 For scattered relocations: The address of the relocatable expression for the item in the file that needs to be updated if the address is changed.
 
ORIGIN origin () const override
 Origin of the relocation. For this object it should be Relocation::ORIGIN::RELOC_TABLE)
 
void pc_relative (bool val) override
 
void size (size_t size) override
 
void value (int32_t value)
 
void accept (Visitor &visitor) const override
 
std::ostream & print (std::ostream &os) const override
 
 Relocation ()=default
 
 Relocation (uint64_t address, uint8_t type)
 
 Relocation (const Relocation &other)
 
- Public Member Functions inherited from LIEF::MachO::Relocation
 Relocation ()=default
 
 Relocation (uint64_t address, uint8_t type)
 
Relocationoperator= (const Relocation &other)
 
 Relocation (const Relocation &other)
 
void swap (Relocation &other) noexcept
 
 ~Relocation () override=default
 
virtual uint8_t type () const
 Type of the relocation according to the Relocation::architecture and/or the Relocation::origin.
 
Header::CPU_TYPE architecture () const
 Achitecture targeted by this relocation.
 
bool has_symbol () const
 true if the relocation has a symbol associated with
 
Symbolsymbol ()
 Symbol associated with the relocation, if any, otherwise a nullptr.
 
const Symbolsymbol () const
 
bool has_section () const
 true if the relocation has a section associated with
 
Sectionsection ()
 Section associated with the relocation, if any, otherwise a nullptr.
 
const Sectionsection () const
 
bool has_segment () const
 true if the relocation has a SegmentCommand associated with
 
SegmentCommandsegment ()
 SegmentCommand associated with the relocation, if any, otherwise a nullptr.
 
const SegmentCommandsegment () const
 
template<class T >
const T * cast () const
 
template<class T >
T * cast ()
 
virtual void type (uint8_t type)
 
virtual void address (uint64_t address)
 
- 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 bool classof (const Relocation &r)
 

Additional Inherited Members

- Public Types inherited from LIEF::MachO::Relocation
enum class  ORIGIN { UNKNOWN = 0 , DYLDINFO = 1 , RELOC_TABLE = 2 , CHAINED_FIXUPS = 3 }
 
- 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>>>
 
- Static Public Attributes inherited from LIEF::MachO::Relocation
static constexpr auto R_SCATTERED = uint32_t(0x80000000)
 
static constexpr auto R_ABS = uint32_t(0)
 

Detailed Description

Class that represents a relocation presents in the MachO object file (.o). Usually, this kind of relocation is found in the MachO::Section.

See also
RelocationDyld

Constructor & Destructor Documentation

◆ RelocationObject() [1/4]

LIEF::MachO::RelocationObject::RelocationObject ( )
default

◆ RelocationObject() [2/4]

LIEF::MachO::RelocationObject::RelocationObject ( const details::relocation_info & relocinfo)

◆ RelocationObject() [3/4]

LIEF::MachO::RelocationObject::RelocationObject ( const details::scattered_relocation_info & scattered_relocinfo)

◆ RelocationObject() [4/4]

LIEF::MachO::RelocationObject::RelocationObject ( const RelocationObject & other)
default

◆ ~RelocationObject()

LIEF::MachO::RelocationObject::~RelocationObject ( )
overridedefault

Member Function Documentation

◆ accept()

void LIEF::MachO::RelocationObject::accept ( Visitor & visitor) const
overridevirtual

Reimplemented from LIEF::MachO::Relocation.

◆ address()

uint64_t LIEF::MachO::RelocationObject::address ( ) const
overridevirtual

Address where the relocation is applied This address is relative to the start of the section where the relocation takes place.

Reimplemented from LIEF::MachO::Relocation.

◆ classof()

static bool LIEF::MachO::RelocationObject::classof ( const Relocation & r)
inlinestatic

◆ clone()

std::unique_ptr< Relocation > LIEF::MachO::RelocationObject::clone ( ) const
inlineoverridevirtual

◆ is_pc_relative()

bool LIEF::MachO::RelocationObject::is_pc_relative ( ) const
inlineoverridevirtual

Whether the relocation is PC relative.

Implements LIEF::MachO::Relocation.

◆ is_scattered()

bool LIEF::MachO::RelocationObject::is_scattered ( ) const
inline

true if the relocation is a scattered one

◆ operator=()

RelocationObject & LIEF::MachO::RelocationObject::operator= ( const RelocationObject & other)
default

◆ origin()

ORIGIN LIEF::MachO::RelocationObject::origin ( ) const
inlineoverridevirtual

Origin of the relocation. For this object it should be Relocation::ORIGIN::RELOC_TABLE)

Implements LIEF::MachO::Relocation.

◆ pc_relative()

void LIEF::MachO::RelocationObject::pc_relative ( bool val)
inlineoverridevirtual

◆ print()

std::ostream & LIEF::MachO::RelocationObject::print ( std::ostream & os) const
inlineoverridevirtual

Reimplemented from LIEF::MachO::Relocation.

◆ Relocation() [1/3]

LIEF::MachO::Relocation::Relocation ( )
default

◆ Relocation() [2/3]

LIEF::MachO::Relocation::Relocation ( const Relocation & other)

◆ Relocation() [3/3]

LIEF::MachO::Relocation::Relocation ( uint64_t address,
uint8_t type )

◆ size() [1/2]

size_t LIEF::MachO::RelocationObject::size ( ) const
overridevirtual

Size of the relocation.

Reimplemented from LIEF::MachO::Relocation.

◆ size() [2/2]

void LIEF::MachO::RelocationObject::size ( size_t size)
overridevirtual

Reimplemented from LIEF::MachO::Relocation.

◆ swap()

void LIEF::MachO::RelocationObject::swap ( RelocationObject & other)
noexcept

◆ value() [1/2]

int32_t LIEF::MachO::RelocationObject::value ( ) const

For scattered relocations: The address of the relocatable expression for the item in the file that needs to be updated if the address is changed.

For relocatable expressions with the difference of two section addresses, the address from which to subtract (in mathematical terms, the minuend) is contained in the first relocation entry and the address to subtract (the subtrahend) is contained in the second relocation entry.

◆ value() [2/2]

void LIEF::MachO::RelocationObject::value ( int32_t value)

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