LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
DynamicFixupARM64Kernel.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2025 R. Thomas
2 * Copyright 2017 - 2025 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_PE_LOAD_CONFIGURATION_DYNAMIC_FIXUP_ARM64_KERNEL_H
17#define LIEF_PE_LOAD_CONFIGURATION_DYNAMIC_FIXUP_ARM64_KERNEL_H
18#include <vector>
20
21#include "LIEF/iterators.hpp"
22
23namespace LIEF {
24namespace PE {
29 public:
30 static constexpr auto NO_IAT_INDEX = 0x7fff;
31
32 enum class IMPORT_TYPE : uint8_t {
33 STATIC = 0,
34 DELAYED = 1,
35 };
36 struct LIEF_API reloc_entry_t { uint32_t rva = 0;
41 bool indirect_call = false;
44 uint8_t register_index = 0;
48 IMPORT_TYPE import_type = IMPORT_TYPE::STATIC;
51 uint16_t iat_index = NO_IAT_INDEX;
55
56 std::string to_string() const;
57
58 friend LIEF_API
59 std::ostream& operator<<(std::ostream& os, const reloc_entry_t& entry)
60 {
61 os << entry.to_string();
62 return os;
63 }
64 };
65
66 using reloc_entries_t = std::vector<reloc_entry_t>;
67 using it_relocations = ref_iterator<reloc_entries_t&>;
68 using it_const_relocations = const_ref_iterator<const reloc_entries_t&>;
69
71 DynamicFixup(KIND::ARM64_KERNEL_IMPORT_CALL_TRANSFER)
72 {}
73
74 DynamicFixupARM64Kernel(const DynamicFixupARM64Kernel&) = default;
75 DynamicFixupARM64Kernel& operator=(const DynamicFixupARM64Kernel&) = default;
76
77 DynamicFixupARM64Kernel(DynamicFixupARM64Kernel&&) = default;
78 DynamicFixupARM64Kernel& operator=(DynamicFixupARM64Kernel&&) = default;
79
80 std::unique_ptr<DynamicFixup> clone() const override {
81 return std::unique_ptr<DynamicFixupARM64Kernel>(new DynamicFixupARM64Kernel(*this));
82 }
83
84 std::string to_string() const override;
85 it_relocations relocations() {
88 return entries_;
89 }
90
91 it_const_relocations relocations() const {
92 return entries_;
93 }
94
95 static bool classof(const DynamicFixup* fixup) {
96 return fixup->kind() == KIND::ARM64_KERNEL_IMPORT_CALL_TRANSFER;
97 }
98
99 ~DynamicFixupARM64Kernel() override = default;
100 LIEF_LOCAL static
103 std::unique_ptr<DynamicFixupARM64Kernel> parse(Parser& ctx, SpanStream& strm);
104
105 private:
106 reloc_entries_t entries_;
107};
108
109
110}
111}
112
113#endif
DynamicFixup.hpp
LIEF::PE::DynamicFixupARM64Kernel
This class wraps fixups associated with the (special) symbol value: IMAGE_DYNAMIC_RELOCATION_ARM64_KE...
Definition DynamicFixupARM64Kernel.hpp:28
LIEF::PE::DynamicFixupARM64Kernel::DynamicFixupARM64Kernel
DynamicFixupARM64Kernel()
Definition DynamicFixupARM64Kernel.hpp:70
LIEF::PE::DynamicFixupARM64Kernel::~DynamicFixupARM64Kernel
~DynamicFixupARM64Kernel() override=default
LIEF::PE::DynamicFixupARM64Kernel::clone
std::unique_ptr< DynamicFixup > clone() const override
Definition DynamicFixupARM64Kernel.hpp:80
LIEF::PE::DynamicFixupARM64Kernel::DynamicFixupARM64Kernel
DynamicFixupARM64Kernel(DynamicFixupARM64Kernel &&)=default
LIEF::PE::DynamicFixupARM64Kernel::to_string
std::string to_string() const override
LIEF::PE::DynamicFixupARM64Kernel::operator=
DynamicFixupARM64Kernel & operator=(const DynamicFixupARM64Kernel &)=default
LIEF::PE::DynamicFixupARM64Kernel::classof
static bool classof(const DynamicFixup *fixup)
Definition DynamicFixupARM64Kernel.hpp:95
LIEF::PE::DynamicFixupARM64Kernel::operator=
DynamicFixupARM64Kernel & operator=(DynamicFixupARM64Kernel &&)=default
LIEF::PE::DynamicFixupARM64Kernel::relocations
it_const_relocations relocations() const
Definition DynamicFixupARM64Kernel.hpp:91
LIEF::PE::DynamicFixupARM64Kernel::relocations
it_relocations relocations()
Iterator over the relocations.
Definition DynamicFixupARM64Kernel.hpp:87
LIEF::PE::DynamicFixupARM64Kernel::DynamicFixupARM64Kernel
DynamicFixupARM64Kernel(const DynamicFixupARM64Kernel &)=default
LIEF::PE::DynamicFixup
This is the base class for any fixups located in DynamicRelocation.
Definition DynamicFixup.hpp:34
LIEF::PE::DynamicFixup::kind
KIND kind() const
Encoding of the fixups.
Definition DynamicFixup.hpp:73
iterators.hpp
LIEF::PE
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:36
LIEF::PE::DynamicFixupARM64Kernel::reloc_entry_t::operator<<
friend std::ostream & operator<<(std::ostream &os, const reloc_entry_t &entry)
Definition DynamicFixupARM64Kernel.hpp:59
LIEF::PE::DynamicFixupARM64Kernel::reloc_entry_t::to_string
std::string to_string() const
LIEF_API
#define LIEF_API
Definition visibility.h:41
LIEF_LOCAL
#define LIEF_LOCAL
Definition visibility.h:42