LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
RelocationDyld.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 * Copyright 2017 - 2026 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_MACHO_RELOCATION_DYLD_COMMAND_H
17#define LIEF_MACHO_RELOCATION_DYLD_COMMAND_H
18#include <memory>
19#include <ostream>
20
21#include "LIEF/visibility.h"
22
24
25
26namespace LIEF::MachO {
27
28class BinaryParser;
29
35
36 friend class BinaryParser;
37
38 public:
40 using LIEF::Relocation::operator<;
41 using LIEF::Relocation::operator<=;
42 using LIEF::Relocation::operator>;
43 using LIEF::Relocation::operator>=;
44 RelocationDyld() = default;
45
47 RelocationDyld(const RelocationDyld&) = default;
48
49 ~RelocationDyld() override = default;
50
51 std::unique_ptr<Relocation> clone() const override {
52 return std::make_unique<RelocationDyld>(*this);
53 }
54
60 bool is_pc_relative() const override;
61
64 ORIGIN origin() const override {
65 return ORIGIN::DYLDINFO;
66 }
67
68 void pc_relative(bool val) override;
69
70 bool operator<(const RelocationDyld& rhs) const;
71 bool operator>=(const RelocationDyld& rhs) const {
72 return !(*this < rhs);
73 }
74
75 bool operator>(const RelocationDyld& rhs) const;
76 bool operator<=(const RelocationDyld& rhs) const {
77 return !(*this > rhs);
78 }
79
80 void accept(Visitor& visitor) const override;
81
82 static bool classof(const Relocation& r) {
84 }
85
86 std::ostream& print(std::ostream& os) const override {
87 return Relocation::print(os);
88 }
89};
90
91}
92
93#endif
Class used to parse a single binary (i.e. non-FAT).
Definition BinaryParser.hpp:79
RelocationDyld(const RelocationDyld &)=default
ORIGIN origin() const override
Origin of the relocation. For this concrete object, it should be Relocation::ORIGIN::DYLDINFO.
Definition RelocationDyld.hpp:64
void pc_relative(bool val) override
std::ostream & print(std::ostream &os) const override
Definition RelocationDyld.hpp:86
bool is_pc_relative() const override
Indicates whether the item containing the address to be relocated is part of a CPU instruction that u...
friend class BinaryParser
Definition RelocationDyld.hpp:36
std::unique_ptr< Relocation > clone() const override
Definition RelocationDyld.hpp:51
bool operator<(const RelocationDyld &rhs) const
bool operator>=(const RelocationDyld &rhs) const
Definition RelocationDyld.hpp:71
RelocationDyld & operator=(const RelocationDyld &)=default
bool operator>(const RelocationDyld &rhs) const
bool operator<=(const RelocationDyld &rhs) const
Definition RelocationDyld.hpp:76
~RelocationDyld() override=default
void accept(Visitor &visitor) const override
static bool classof(const Relocation &r)
Definition RelocationDyld.hpp:82
virtual ORIGIN origin() const =0
Origin of the relocation.
ORIGIN
Definition MachO/Relocation.hpp:48
@ DYLDINFO
Definition MachO/Relocation.hpp:50
virtual std::ostream & print(std::ostream &os) const
Definition Visitor.hpp:212
Namespace related to the LIEF's Mach-O module.
Definition Abstract/Header.hpp:36
#define LIEF_API
Definition visibility.h:45