15#ifndef LIEF_MACHO_RELOCATION_FIXUP_H
16#define LIEF_MACHO_RELOCATION_FIXUP_H
29struct dyld_chained_ptr_arm64e_rebase;
30struct dyld_chained_ptr_arm64e_auth_rebase;
31struct dyld_chained_ptr_64_rebase;
32struct dyld_chained_ptr_32_rebase;
33struct dyld_chained_ptr_arm64e_segmented_rebase;
34struct dyld_chained_ptr_arm64e_auth_segmented_rebase;
73 return std::make_unique<RelocationFixup>(*
this);
131 std::ostream&
print(std::ostream& os)
const override;
134 enum class REBASE_TYPES {
145 LIEF_LOCAL void set(
const details::dyld_chained_ptr_arm64e_rebase& fixup);
146 LIEF_LOCAL void set(
const details::dyld_chained_ptr_arm64e_auth_rebase& fixup);
147 LIEF_LOCAL void set(
const details::dyld_chained_ptr_64_rebase& fixup);
148 LIEF_LOCAL void set(
const details::dyld_chained_ptr_32_rebase& fixup);
150 set(
const details::dyld_chained_ptr_arm64e_segmented_rebase& fixup);
152 set(
const details::dyld_chained_ptr_arm64e_auth_segmented_rebase& fixup);
155 uint64_t imagebase_ = 0;
156 uint32_t offset_ = 0;
158 REBASE_TYPES rtypes_ = REBASE_TYPES::UNKNOWN;
161 details::dyld_chained_ptr_arm64e_rebase* arm64_rebase_ =
nullptr;
162 details::dyld_chained_ptr_arm64e_auth_rebase* arm64_auth_rebase_;
163 details::dyld_chained_ptr_64_rebase* p64_rebase_;
164 details::dyld_chained_ptr_32_rebase* p32_rebase_;
165 details::dyld_chained_ptr_arm64e_segmented_rebase* segmented_rebase_;
166 details::dyld_chained_ptr_arm64e_auth_segmented_rebase* auth_segmented_rebase_;
Class used to parse a single binary (i.e. non-FAT).
Definition BinaryParser.hpp:80
Class used to rebuild a Mach-O file.
Definition MachO/Builder.hpp:63
Definition DyldChainedFixupsCreator.hpp:41
RelocationFixup & operator=(RelocationFixup &&) noexcept=default
RelocationFixup(DYLD_CHAINED_PTR_FORMAT fmt, uint64_t imagebase)
void offset(uint32_t offset)
Definition RelocationFixup.hpp:105
std::ostream & print(std::ostream &os) const override
friend class BinaryParser
Definition RelocationFixup.hpp:56
void target(uint64_t target)
uint32_t next() const
Return the (unscaled) next offset in the chain.
uint64_t target() const
The value that should be set at the address pointed by LIEF::Relocation::address if the imagebase cho...
friend class DyldChainedFixupsCreator
Definition RelocationFixup.hpp:58
ORIGIN origin() const override
Origin of the relocation. For this concrete object, it should be Relocation::ORIGIN::CHAINED_FIXUPS.
Definition RelocationFixup.hpp:83
uint32_t offset() const
Definition RelocationFixup.hpp:101
void pc_relative(bool) override
Not relevant for this kind of relocation.
Definition RelocationFixup.hpp:99
friend class Builder
Definition RelocationFixup.hpp:57
void next(uint32_t value)
Change next offset of the current element.
uint64_t address() const override
The address of this relocation is bound to its offset.
Definition RelocationFixup.hpp:110
static bool classof(const Relocation &r)
Definition RelocationFixup.hpp:127
bool is_pc_relative() const override
Not relevant for this kind of relocation.
Definition RelocationFixup.hpp:77
RelocationFixup & operator=(const RelocationFixup &)
void address(uint64_t address) override
Changing the address means changing the offset.
Definition RelocationFixup.hpp:115
RelocationFixup(const RelocationFixup &)
std::unique_ptr< Relocation > clone() const override
Definition RelocationFixup.hpp:72
DYLD_CHAINED_PTR_FORMAT ptr_format() const
Definition RelocationFixup.hpp:87
void accept(Visitor &visitor) const override
virtual ORIGIN origin() const =0
Origin of the relocation.
ORIGIN
Definition MachO/Relocation.hpp:47
@ CHAINED_FIXUPS
Definition MachO/Relocation.hpp:51
Definition Visitor.hpp:211
Definition endianness_support.hpp:62
Namespace related to the LIEF's Mach-O module.
Definition Abstract/Header.hpp:35
@ UNKNOWN
Definition MachO/enums.hpp:25
DYLD_CHAINED_PTR_FORMAT
Definition DyldChainedFormat.hpp:34
@ PTR_32
Definition DyldChainedFormat.hpp:40
#define LIEF_API
Definition visibility.h:44
#define LIEF_LOCAL
Definition visibility.h:45