LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
LIEF::MachO::Relocation Class Referenceabstract

Class that represents a Mach-O relocation. More...

#include <Relocation.hpp>

Inheritance diagram for LIEF::MachO::Relocation:
Collaboration diagram for LIEF::MachO::Relocation:

Public Types

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

Public Member Functions

 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 std::unique_ptr< Relocationclone () const =0
 
virtual bool is_pc_relative () const =0
 Indicates whether the item containing the address to be relocated is part of a CPU instruction that uses PC-relative addressing.
 
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.
 
virtual ORIGIN origin () const =0
 Origin of the 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
 
virtual void pc_relative (bool val)=0
 
virtual void type (uint8_t type)
 
void accept (Visitor &visitor) const override
 
virtual std::ostream & print (std::ostream &os) const
 
- Public Member Functions inherited from LIEF::Relocation
 Relocation ()
 
 Relocation (uint64_t address, uint8_t size)
 Constructor from a relocation's address and size.
 
 ~Relocation () override
 
Relocationoperator= (const Relocation &)
 
 Relocation (const Relocation &)
 
void swap (Relocation &other)
 
virtual uint64_t address () const
 Relocation's address.
 
virtual size_t size () const
 Relocation size in bits
 
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 ()
 
 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 Attributes

static constexpr auto R_SCATTERED = uint32_t(0x80000000)
 
static constexpr auto R_ABS = uint32_t(0)
 

Detailed Description

Class that represents a Mach-O relocation.

See also
:

Member Enumeration Documentation

◆ ORIGIN

Enumerator
UNKNOWN 
DYLDINFO 
RELOC_TABLE 
CHAINED_FIXUPS 

Constructor & Destructor Documentation

◆ Relocation() [1/3]

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

◆ Relocation() [2/3]

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

◆ Relocation() [3/3]

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

◆ ~Relocation()

LIEF::MachO::Relocation::~Relocation ( )
overridedefault

Member Function Documentation

◆ accept()

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

◆ architecture()

Header::CPU_TYPE LIEF::MachO::Relocation::architecture ( ) const
inline

Achitecture targeted by this relocation.

◆ clone()

virtual std::unique_ptr< Relocation > LIEF::MachO::Relocation::clone ( ) const
pure virtual

◆ has_section()

bool LIEF::MachO::Relocation::has_section ( ) const
inline

true if the relocation has a section associated with

◆ has_segment()

bool LIEF::MachO::Relocation::has_segment ( ) const
inline

true if the relocation has a SegmentCommand associated with

◆ has_symbol()

bool LIEF::MachO::Relocation::has_symbol ( ) const
inline

true if the relocation has a symbol associated with

◆ is_pc_relative()

virtual bool LIEF::MachO::Relocation::is_pc_relative ( ) const
pure virtual

Indicates whether the item containing the address to be relocated is part of a CPU instruction that uses PC-relative addressing.

For addresses contained in PC-relative instructions, the CPU adds the address of the instruction to the address contained in the instruction.

Implemented in LIEF::MachO::RelocationDyld, LIEF::MachO::RelocationFixup, and LIEF::MachO::RelocationObject.

◆ operator=()

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

◆ origin()

virtual ORIGIN LIEF::MachO::Relocation::origin ( ) const
pure virtual

◆ pc_relative()

virtual void LIEF::MachO::Relocation::pc_relative ( bool val)
pure virtual

◆ print()

virtual std::ostream & LIEF::MachO::Relocation::print ( std::ostream & os) const
virtual

◆ section() [1/2]

Section * LIEF::MachO::Relocation::section ( )
inline

Section associated with the relocation, if any, otherwise a nullptr.

◆ section() [2/2]

const Section * LIEF::MachO::Relocation::section ( ) const
inline

◆ segment() [1/2]

SegmentCommand * LIEF::MachO::Relocation::segment ( )
inline

SegmentCommand associated with the relocation, if any, otherwise a nullptr.

◆ segment() [2/2]

const SegmentCommand * LIEF::MachO::Relocation::segment ( ) const
inline

◆ swap()

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

◆ symbol() [1/2]

Symbol * LIEF::MachO::Relocation::symbol ( )
inline

Symbol associated with the relocation, if any, otherwise a nullptr.

◆ symbol() [2/2]

const Symbol * LIEF::MachO::Relocation::symbol ( ) const
inline

◆ type() [1/2]

virtual uint8_t LIEF::MachO::Relocation::type ( ) const
inlinevirtual

◆ type() [2/2]

virtual void LIEF::MachO::Relocation::type ( uint8_t type)
virtual

Member Data Documentation

◆ R_ABS

auto LIEF::MachO::Relocation::R_ABS = uint32_t(0)
staticconstexpr

◆ R_SCATTERED

auto LIEF::MachO::Relocation::R_SCATTERED = uint32_t(0x80000000)
staticconstexpr

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