LIEF: Library to Instrument Executable Formats Version 0.17.0
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
16#ifndef LIEF_PE_RELOCATION_ENTRY_H
17#define LIEF_PE_RELOCATION_ENTRY_H
40 friend class PE::Relocation;
43 static constexpr auto MAX_ADDR = 1 << 12;
44 enum class BASE_TYPES {
97 MIPS_JMPADDR = 5 | (1 << 8),
98 ARM_MOV32 = 5 | (1 << 9),
99 RISCV_HI20 = 5 | (1 << 10),
103 THUMB_MOV32 = 7 | (1 << 11),
104 RISCV_LOW12I = 7 | (1 << 12),
106 RISCV_LOW12S = 8 | (1 << 13),
107 LOONARCH_MARK_LA = 8 | (1 << 14),
129 return (data >> 12) & 0xFF;
136 LIEF::Relocation(other),
137 position_(other.position_),
149 RelocationEntry&
operator=(RelocationEntry&& other) =
default;
155 assert(position_ < MAX_ADDR);
160 void swap(RelocationEntry& other) {
162 std::swap(position_, other.position_);
163 std::swap(type_, other.type_);
164 std::swap(relocation_, other.relocation_);
166 uint64_t
address()
const override;
171 size_t size()
const override;
175 void size(
size_t size)
override;
176 uint16_t
data()
const {
181 return (uint16_t((uint8_t)type_ & 0xFF) << 12) | position_;
188 BASE_TYPES
type()
const {
195 assert(position < MAX_ADDR);
196 position_ = position;
203 void accept(Visitor& visitor)
const override;
211 LIEF_LOCAL const PE::Relocation* parent()
const {
223 uint16_t position_ = 0;
224 BASE_TYPES type_ = BASE_TYPES::ABS;
225 PE::Relocation* relocation_ =
nullptr;
Class which represents an entry of the PE relocation table.
Definition RelocationEntry.hpp:36
void address(uint64_t address) override
RelocationEntry & operator=(RelocationEntry other)
Definition RelocationEntry.hpp:143
void swap(RelocationEntry &other)
Definition RelocationEntry.hpp:160
size_t size() const override
The size of the relocatable pointer.
void size(size_t size) override
uint16_t position() const
Offset relative to Relocation::virtual_address where the relocation occurs.
Definition RelocationEntry.hpp:185
RelocationEntry()=default
uint16_t data() const
Raw data of the relocation:
Definition RelocationEntry.hpp:180
RelocationEntry(uint16_t position, BASE_TYPES type)
Definition RelocationEntry.hpp:151
uint64_t address() const override
The address of the relocation.
friend std::ostream & operator<<(std::ostream &os, const RelocationEntry &entry)
void accept(Visitor &visitor) const override
Method so that the visitor can visit us.
RelocationEntry(const RelocationEntry &other)
Definition RelocationEntry.hpp:135
void position(uint16_t position)
Definition RelocationEntry.hpp:194
static BASE_TYPES type_from_data(Header::MACHINE_TYPES arch, uint16_t data)
~RelocationEntry() override=default
static uint16_t get_type(uint16_t data)
Definition RelocationEntry.hpp:128
BASE_TYPES
Relocation type as described in https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#base-...
Definition RelocationEntry.hpp:47
static uint16_t get_position(uint16_t data)
Definition RelocationEntry.hpp:124
RelocationEntry(RelocationEntry &&other)=default
void type(BASE_TYPES type)
Definition RelocationEntry.hpp:199
BASE_TYPES type() const
Type of the relocation.
Definition RelocationEntry.hpp:190
RelocationEntry & operator=(RelocationEntry &&other)=default
Class which represents the Base Relocation Block We usually find this structure in the ....
Definition PE/Relocation.hpp:42
void swap(Relocation &other)
Definition Abstract/Relocation.hpp:42
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
const char * to_string(AuxiliaryWeakExternal::CHARACTERISTICS e)
@ LIEF
Definition PE/utils.hpp:35
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41
#define LIEF_LOCAL
Definition visibility.h:42