LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
LIEF::MachO::RelocationFixup Class Reference

Class that represents a rebase relocation found in the LC_DYLD_CHAINED_FIXUPS command. More...

#include <RelocationFixup.hpp>

Inheritance diagram for LIEF::MachO::RelocationFixup:
Inheritance graph
[legend]
Collaboration diagram for LIEF::MachO::RelocationFixup:
Collaboration graph
[legend]

Public Member Functions

 RelocationFixup (DYLD_CHAINED_PTR_FORMAT fmt, uint64_t imagebase)
 
RelocationFixupoperator= (const RelocationFixup &)
 
 RelocationFixup (const RelocationFixup &)
 
RelocationFixupoperator= (RelocationFixup &&)
 
 RelocationFixup (RelocationFixup &&)
 
Relocationclone () const override
 
bool is_pc_relative () const override
 Not relevant for this kind of relocation.
 
RELOCATION_ORIGINS origin () const override
 Origin of the relocation. For this concrete object, it should be RELOCATION_ORIGINS::ORIGIN_CHAINED_FIXUPS.
 
DYLD_CHAINED_PTR_FORMAT ptr_format () const
 
uint64_t target () const
 The value that should be set at LIEF::Relocation::address if the imagebase is LIEF::Binary::imagebase. Otherwise, it should be: target() - LIEF::Binary::imagebase() + new_imagebase.
 
void target (uint64_t target)
 
void pc_relative (bool) override
 Not relevant for this kind of relocation.
 
uint32_t offset () const
 
void offset (uint32_t offset)
 
uint64_t address () const override
 The address of this relocation is bound to its offset.
 
void address (uint64_t address) override
 Changing the address means changing the offset.
 
void accept (Visitor &visitor) const override
 
std::ostream & print (std::ostream &os) const override
 
- Public Member Functions inherited from LIEF::MachO::Relocation
 Relocation (uint64_t address, uint8_t type)
 
Relocationoperator= (const Relocation &other)
 
 Relocation (const Relocation &other)
 
void swap (Relocation &other)
 
virtual uint8_t type () const
 Type of the relocation according to the Relocation::architecture and/or the Relocation::origin.
 
CPU_TYPES 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
 
virtual void type (uint8_t type)
 
- 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 size_t size () const
 Relocation size in bits
 
virtual void size (size_t size)
 
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
 

Static Public Member Functions

static bool classof (const Relocation &r)
 

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 a rebase relocation found in the LC_DYLD_CHAINED_FIXUPS command.

This class extends LIEF::Relocation in which LIEF::Relocation::address is set to the absolute virtual address where the relocation must take place (e.g. 0x10000d270).

On the other hand, RelocationFixup::target contains the value that should be set at LIEF::Relocation::address if the imagebase is LIEF::Binary::imagebase (e.g. 0x1000073a8).

If the Mach-O loader chooses another base address (like 0x7ff100000), it must set 0x10000d270 to 0x7ff1073a8.

Member Function Documentation

◆ accept()

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

Reimplemented from LIEF::MachO::Relocation.

◆ address() [1/2]

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

The address of this relocation is bound to its offset.

Reimplemented from LIEF::Relocation.

◆ address() [2/2]

void LIEF::MachO::RelocationFixup::address ( uint64_t address)
overridevirtual

Changing the address means changing the offset.

Reimplemented from LIEF::Relocation.

◆ clone()

Relocation * LIEF::MachO::RelocationFixup::clone ( ) const
overridevirtual

◆ is_pc_relative()

bool LIEF::MachO::RelocationFixup::is_pc_relative ( ) const
overridevirtual

Not relevant for this kind of relocation.

Implements LIEF::MachO::Relocation.

◆ origin()

RELOCATION_ORIGINS LIEF::MachO::RelocationFixup::origin ( ) const
overridevirtual

Origin of the relocation. For this concrete object, it should be RELOCATION_ORIGINS::ORIGIN_CHAINED_FIXUPS.

Implements LIEF::MachO::Relocation.

◆ pc_relative()

void LIEF::MachO::RelocationFixup::pc_relative ( bool )
overridevirtual

Not relevant for this kind of relocation.

Implements LIEF::MachO::Relocation.

◆ print()

std::ostream & LIEF::MachO::RelocationFixup::print ( std::ostream & os) const
overridevirtual

Reimplemented from LIEF::MachO::Relocation.


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