Class which represents an entry of the PE relocation table.
More...
#include <RelocationEntry.hpp>
|
enum class | BASE_TYPES {
UNKNOWN = -1
, ABS = 0
, HIGH = 1
, LOW = 2
,
HIGHLOW = 3
, HIGHADJ = 4
, MIPS_JMPADDR = 5 | (1 << 8)
, ARM_MOV32 = 5 | (1 << 9)
,
RISCV_HI20 = 5 | (1 << 10)
, SECTION = 6
, THUMB_MOV32 = 7 | (1 << 11)
, RISCV_LOW12I = 7 | (1 << 12)
,
RISCV_LOW12S = 8 | (1 << 13)
, LOONARCH_MARK_LA = 8 | (1 << 14)
, MIPS_JMPADDR16 = 9
, DIR64 = 10
,
HIGH3ADJ = 11
} |
| Relocation type as described in https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#base-relocation-types. More...
|
|
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 constexpr auto | MAX_ADDR = 1 << 12 |
|
Class which represents an entry of the PE relocation table.
It extends the LIEF::Relocation object to provide an uniform API across the file formats
◆ BASE_TYPES
Relocation type as described in https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#base-relocation-types.
Enumerator |
---|
UNKNOWN | |
ABS | This value matches: IMAGE_REL_BASED_ABSOLUTE The base relocation is skipped. This type can be used to pad a block.
|
HIGH | This value matches: IMAGE_REL_BASED_HIGH The base relocation adds the high 16 bits of the difference to the 16-bit field at offset. The 16-bit field represents the high value of a 32-bit word.
Operation:
write<int16_t>(ADDR, ((read<int16_t>(ADDR) << 16) + DELTA) >> 16)
|
LOW | The base relocation adds the low 16 bits of the difference to the 16-bit field at offset. The 16-bit field represents the low half of a 32-bit word.
Operation:
write<int16_t>(ADDR, ((int32_t_t)read<int16_t>(ADDR) + DELTA))
|
HIGHLOW | This value matches IMAGE_REL_BASED_HIGHLOW
The base relocation applies all 32 bits of the difference to the 32-bit field at offset.
Operation:
write<int32_t_t>(ADDR, read<int32_t_t>(ADDR) + DELTA)
|
HIGHADJ | This value matches IMAGE_REL_BASED_HIGHADJ
The base relocation adds the high 16 bits of the difference to the 16-bit field at offset. The 16-bit field represents the high value of a 32-bit word. The low 16 bits of the 32-bit value are stored in the 16-bit word that follows this base relocation. This means that this base relocation occupies two slots.
|
MIPS_JMPADDR | |
ARM_MOV32 | |
RISCV_HI20 | |
SECTION | |
THUMB_MOV32 | |
RISCV_LOW12I | |
RISCV_LOW12S | |
LOONARCH_MARK_LA | |
MIPS_JMPADDR16 | |
DIR64 | This value matches IMAGE_REL_BASED_DIR64
The base relocation applies the difference to the 64-bit field at offset.
Operation:
write<int64_t_t>(ADDR, read<int64_t_t>(ADDR) + DELTA)
|
HIGH3ADJ | |
◆ RelocationEntry() [1/4]
LIEF::PE::RelocationEntry::RelocationEntry |
( |
| ) |
|
|
default |
◆ RelocationEntry() [2/4]
LIEF::PE::RelocationEntry::RelocationEntry |
( |
const RelocationEntry & | other | ) |
|
|
inline |
◆ RelocationEntry() [3/4]
◆ RelocationEntry() [4/4]
LIEF::PE::RelocationEntry::RelocationEntry |
( |
uint16_t | position, |
|
|
BASE_TYPES | type ) |
|
inline |
◆ ~RelocationEntry()
LIEF::PE::RelocationEntry::~RelocationEntry |
( |
| ) |
|
|
overridedefault |
◆ accept()
void LIEF::PE::RelocationEntry::accept |
( |
Visitor & | visitor | ) |
const |
|
overridevirtual |
◆ address() [1/2]
uint64_t LIEF::PE::RelocationEntry::address |
( |
| ) |
const |
|
overridevirtual |
◆ address() [2/2]
void LIEF::PE::RelocationEntry::address |
( |
uint64_t | address | ) |
|
|
overridevirtual |
◆ data()
uint16_t LIEF::PE::RelocationEntry::data |
( |
| ) |
const |
|
inline |
Raw data of the relocation:
- The high 4 bits store the relocation type
- The low 12 bits store the relocation offset
◆ get_position()
static uint16_t LIEF::PE::RelocationEntry::get_position |
( |
uint16_t | data | ) |
|
|
inlinestatic |
◆ get_type()
static uint16_t LIEF::PE::RelocationEntry::get_type |
( |
uint16_t | data | ) |
|
|
inlinestatic |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ position() [1/2]
uint16_t LIEF::PE::RelocationEntry::position |
( |
| ) |
const |
|
inline |
◆ position() [2/2]
void LIEF::PE::RelocationEntry::position |
( |
uint16_t | position | ) |
|
|
inline |
◆ size() [1/2]
size_t LIEF::PE::RelocationEntry::size |
( |
| ) |
const |
|
overridevirtual |
◆ size() [2/2]
void LIEF::PE::RelocationEntry::size |
( |
size_t | size | ) |
|
|
overridevirtual |
◆ swap()
◆ type() [1/2]
BASE_TYPES LIEF::PE::RelocationEntry::type |
( |
| ) |
const |
|
inline |
◆ type() [2/2]
void LIEF::PE::RelocationEntry::type |
( |
BASE_TYPES | type | ) |
|
|
inline |
◆ type_from_data()
◆ MAX_ADDR
auto LIEF::PE::RelocationEntry::MAX_ADDR = 1 << 12 |
|
staticconstexpr |
The documentation for this class was generated from the following file: