LIEF: Library to Instrument Executable Formats Version 0.15.1
|
Class that represents an ELF relocation. More...
#include <Relocation.hpp>
Public Types | |
enum class | PURPOSE { NONE = 0 , PLTGOT = 1 , DYNAMIC = 2 , OBJECT = 3 } |
The purpose of a relocation defines how this relocation is used by the loader. More... | |
enum class | ENCODING { UNKNOWN = 0 , REL , RELA , RELR , ANDROID_SLEB } |
enum class | TYPE : uint32_t { UNKNOWN = uint32_t(-1) , ELF_RELOC , ELF_RELOC , ELF_RELOC , ELF_RELOC , ELF_RELOC , ELF_RELOC , ELF_RELOC , ELF_RELOC , ELF_RELOC , ELF_RELOC , ELF_RELOC } |
The different types of the relocation. More... | |
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 (uint64_t address, TYPE type, ENCODING enc) | |
Relocation ()=default | |
Relocation (ARCH arch) | |
~Relocation () override=default | |
Relocation & | operator= (Relocation other) |
Relocation (const Relocation &other) | |
void | swap (Relocation &other) |
int64_t | addend () const |
Additional value that can be involved in the relocation processing. | |
TYPE | type () const |
Type of the relocation. | |
bool | is_rela () const |
Check if the relocation uses the explicit addend() field (this is usually the case for 64 bits binaries) | |
bool | is_rel () const |
Check if the relocation uses the implicit addend (i.e. not present in the ELF structure) | |
bool | is_relatively_encoded () const |
True if the relocation is using the relative encoding. | |
bool | is_android_packed () const |
True if the relocation is using the Android packed relocation format. | |
uint32_t | info () const |
Relocation info which contains, for instance, the symbol index. | |
uint64_t | r_info (Header::CLASS clazz) const |
(re)Compute the raw r_info attribute based on the given ELF class | |
ARCH | architecture () const |
Target architecture for this relocation. | |
PURPOSE | purpose () const |
ENCODING | encoding () const |
The encoding of the relocation. | |
bool | is_relative () const |
True if the semantic of the relocation is <ARCH>_RELATIVE | |
size_t | size () const override |
Return the size (in bits) of the value associated with this relocation Return -1 if the size can't be determined. | |
bool | has_symbol () const |
True if the current relocation is associated with a symbol. | |
Symbol * | symbol () |
Symbol associated with the relocation (or a nullptr) | |
const Symbol * | symbol () const |
bool | has_section () const |
True if the relocation has an associated section. | |
Section * | section () |
The section in which the relocation is applied (or a nullptr) | |
const Section * | section () const |
Section * | symbol_table () |
The associated symbol table (or a nullptr) | |
const Section * | symbol_table () const |
void | addend (int64_t addend) |
void | type (TYPE type) |
void | purpose (PURPOSE purpose) |
void | info (uint32_t v) |
void | symbol (Symbol *symbol) |
void | section (Section *section) |
void | symbol_table (Section *section) |
void | accept (Visitor &visitor) const override |
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 | |
Relocation & | operator= (const Relocation &) |
Relocation (const Relocation &) | |
void | swap (Relocation &other) |
virtual uint64_t | address () const |
Relocation's address. | |
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) | |
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 Member Functions | |
static TYPE | type_from (uint32_t value, ARCH arch) |
static uint32_t | to_value (TYPE type) |
Static Public Attributes | |
static constexpr uint64_t | R_BIT = 27 |
static constexpr uint64_t | R_MASK = (uint64_t(1) << R_BIT) - 1 |
static constexpr uint64_t | R_X64 = uint64_t(1) << R_BIT |
static constexpr uint64_t | R_AARCH64 = uint64_t(2) << R_BIT |
static constexpr uint64_t | R_ARM = uint64_t(3) << R_BIT |
static constexpr uint64_t | R_HEXAGON = uint64_t(4) << R_BIT |
static constexpr uint64_t | R_X86 = uint64_t(5) << R_BIT |
static constexpr uint64_t | R_LARCH = uint64_t(6) << R_BIT |
static constexpr uint64_t | R_MIPS = uint64_t(7) << R_BIT |
static constexpr uint64_t | R_PPC = uint64_t(8) << R_BIT |
static constexpr uint64_t | R_PPC64 = uint64_t(9) << R_BIT |
static constexpr uint64_t | R_SPARC = uint64_t(10) << R_BIT |
static constexpr uint64_t | R_SYSZ = uint64_t(11) << R_BIT |
Class that represents an ELF relocation.
|
strong |
|
strong |
|
strong |
|
default |
|
inline |
|
overridedefault |
LIEF::ELF::Relocation::Relocation | ( | const Relocation & | other | ) |
|
overridevirtual |
Implements LIEF::Object.
|
inline |
Additional value that can be involved in the relocation processing.
|
inline |
|
inline |
Target architecture for this relocation.
|
inline |
The encoding of the relocation.
|
inline |
True if the relocation has an associated section.
|
inline |
True if the current relocation is associated with a symbol.
|
inline |
Relocation info which contains, for instance, the symbol index.
|
inline |
|
inline |
True if the relocation is using the Android packed relocation format.
|
inline |
Check if the relocation uses the implicit addend (i.e. not present in the ELF structure)
|
inline |
Check if the relocation uses the explicit addend() field (this is usually the case for 64 bits binaries)
|
inline |
True if the semantic of the relocation is <ARCH>_RELATIVE
|
inline |
True if the relocation is using the relative encoding.
Relocation & LIEF::ELF::Relocation::operator= | ( | Relocation | other | ) |
|
inline |
|
inline |
|
inline |
(re)Compute the raw r_info
attribute based on the given ELF class
|
inline |
The section in which the relocation is applied (or a nullptr)
|
inline |
|
inline |
|
overridevirtual |
Return the size (in bits) of the value associated with this relocation Return -1 if the size can't be determined.
Reimplemented from LIEF::Relocation.
void LIEF::ELF::Relocation::swap | ( | Relocation & | other | ) |
|
inline |
Symbol associated with the relocation (or a nullptr)
|
inline |
|
inline |
|
inline |
The associated symbol table (or a nullptr)
|
inline |
|
inline |
|
inlinestatic |
|
inline |
Type of the relocation.
|
inline |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |