LIEF: Library to Instrument Executable Formats Version 0.16.0
|
Class that represents a Mach-O relocation. More...
#include <Relocation.hpp>
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) | |
Relocation & | operator= (const Relocation &other) |
Relocation (const Relocation &other) | |
void | swap (Relocation &other) noexcept |
~Relocation () override=default | |
virtual std::unique_ptr< Relocation > | clone () 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 | |
Symbol * | symbol () |
Symbol associated with the relocation, if any, otherwise a nullptr. | |
const Symbol * | symbol () const |
bool | has_section () const |
true if the relocation has a section associated with | |
Section * | section () |
Section associated with the relocation, if any, otherwise a nullptr. | |
const Section * | section () const |
bool | has_segment () const |
true if the relocation has a SegmentCommand associated with | |
SegmentCommand * | segment () |
SegmentCommand associated with the relocation, if any, otherwise a nullptr. | |
const SegmentCommand * | segment () const |
template<class T > | |
const T * | cast () const |
template<class T > | |
T * | cast () |
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 |
virtual uint64_t | address () const |
Relocation's address. | |
virtual void | address (uint64_t address) |
virtual size_t | size () const |
Relocation size in bits | |
virtual void | size (size_t size) |
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 | |
Relocation & | operator= (const Relocation &)=default |
Relocation (const Relocation &)=default | |
void | swap (Relocation &other) |
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) | |
Object & | operator= (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) |
Class that represents a Mach-O relocation.
|
strong |
|
default |
LIEF::MachO::Relocation::Relocation | ( | uint64_t | address, |
uint8_t | type ) |
LIEF::MachO::Relocation::Relocation | ( | const Relocation & | other | ) |
|
overridedefault |
|
overridevirtual |
Implements LIEF::Object.
Reimplemented in LIEF::MachO::RelocationDyld, LIEF::MachO::RelocationFixup, and LIEF::MachO::RelocationObject.
|
inlinevirtual |
Relocation's address.
Reimplemented from LIEF::Relocation.
Reimplemented in LIEF::MachO::RelocationFixup, and LIEF::MachO::RelocationObject.
|
inlinevirtual |
Reimplemented from LIEF::Relocation.
Reimplemented in LIEF::MachO::RelocationFixup.
|
inline |
Achitecture targeted by this relocation.
|
inline |
|
inline |
|
pure virtual |
Implemented in LIEF::MachO::RelocationDyld, LIEF::MachO::RelocationFixup, and LIEF::MachO::RelocationObject.
|
inline |
true
if the relocation has a section associated with
|
inline |
true
if the relocation has a SegmentCommand associated with
|
inline |
true
if the relocation has a symbol associated with
|
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.
Relocation & LIEF::MachO::Relocation::operator= | ( | const Relocation & | other | ) |
|
pure virtual |
Origin of the relocation.
Implemented in LIEF::MachO::RelocationDyld, LIEF::MachO::RelocationFixup, and LIEF::MachO::RelocationObject.
Referenced by LIEF::MachO::RelocationDyld::classof(), LIEF::MachO::RelocationFixup::classof(), and LIEF::MachO::RelocationObject::classof().
|
pure virtual |
Implemented in LIEF::MachO::RelocationDyld, LIEF::MachO::RelocationFixup, and LIEF::MachO::RelocationObject.
|
virtual |
Reimplemented in LIEF::MachO::RelocationDyld, LIEF::MachO::RelocationFixup, and LIEF::MachO::RelocationObject.
|
inline |
Section associated with the relocation, if any, otherwise a nullptr.
|
inline |
|
inline |
SegmentCommand associated with the relocation, if any, otherwise a nullptr.
|
inline |
|
inlinevirtual |
Relocation size in bits
Reimplemented from LIEF::Relocation.
Reimplemented in LIEF::MachO::RelocationObject.
|
inlinevirtual |
Reimplemented from LIEF::Relocation.
Reimplemented in LIEF::MachO::RelocationObject.
|
noexcept |
|
inline |
Symbol associated with the relocation, if any, otherwise a nullptr.
|
inline |
|
inlinevirtual |
Type of the relocation according to the Relocation::architecture and/or the Relocation::origin.
See:
|
virtual |
|
staticconstexpr |
|
staticconstexpr |