LIEF: Library to Instrument Executable Formats Version 0.17.0
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
16#ifndef LIEF_MACHO_BINDING_INFO_H
17#define LIEF_MACHO_BINDING_INFO_H
41 friend class BinaryParser;
42 friend class DyldChainedFixupsCreator;
58 BindingInfo& operator=(BindingInfo&&) noexcept = default;
60 void swap(BindingInfo& other) noexcept;
61 bool has_segment()
const {
64 return segment_ !=
nullptr;
66 const SegmentCommand*
segment()
const {
78 return library_ !=
nullptr;
80 const DylibCommand*
library()
const {
92 return symbol_ !=
nullptr;
94 const Symbol*
symbol()
const {
103 virtual uint64_t
address()
const {
114 return library_ordinal_;
118 library_ordinal_ = ordinal;
131 return is_weak_import_;
135 is_weak_import_ = val;
137 virtual TYPES
type()
const = 0;
144 void accept(Visitor& visitor)
const override;
148 static_assert(std::is_base_of<BindingInfo, T>::value,
"Require BindingInfo inheritance");
149 if (T::classof(
this)) {
150 return static_cast<const T*
>(
this);
157 return const_cast<T*
>(
static_cast<const BindingInfo*
>(
this)->cast<T>());
163 SegmentCommand* segment_ =
nullptr;
164 Symbol* symbol_ =
nullptr;
165 int32_t library_ordinal_ = 0;
167 bool is_weak_import_ =
false;
168 DylibCommand* library_ =
nullptr;
169 uint64_t address_ = 0;
Class used to parse a single binary (i.e. non-FAT)
Definition BinaryParser.hpp:75
Class that provides an interface over a binding operation.
Definition BindingInfo.hpp:39
DylibCommand * library()
Definition BindingInfo.hpp:86
~BindingInfo() override=default
void accept(Visitor &visitor) const override
bool has_symbol() const
Check if a MachO::Symbol is associated with the BindingInfo.
Definition BindingInfo.hpp:91
const T * cast() const
Definition BindingInfo.hpp:147
Symbol * symbol()
Definition BindingInfo.hpp:100
const SegmentCommand * segment() const
The MachO::SegmentCommand associated with the BindingInfo or a nullptr of it is not bind to a Segment...
Definition BindingInfo.hpp:69
int32_t library_ordinal() const
Definition BindingInfo.hpp:113
BindingInfo(BindingInfo &&) noexcept=default
BindingInfo(const BindingInfo &other)
bool has_library() const
Check if a MachO::DylibCommand is tied with the BindingInfo.
Definition BindingInfo.hpp:77
virtual void address(uint64_t addr)
Definition BindingInfo.hpp:109
void set_weak_import(bool val=true)
Definition BindingInfo.hpp:134
friend std::ostream & operator<<(std::ostream &os, const BindingInfo &binding_info)
const Symbol * symbol() const
MachO::Symbol associated with the BindingInfo or a nullptr if not present.
Definition BindingInfo.hpp:97
void library_ordinal(int32_t ordinal)
Definition BindingInfo.hpp:117
T * cast()
Definition BindingInfo.hpp:156
virtual TYPES type() const =0
The type of the binding. This type provides the origin of the binding (LC_DYLD_INFO or LC_DYLD_CHAINE...
virtual uint64_t address() const
Address of the binding.
Definition BindingInfo.hpp:105
bool is_weak_import() const
Definition BindingInfo.hpp:130
SegmentCommand * segment()
Definition BindingInfo.hpp:72
const DylibCommand * library() const
MachO::DylibCommand associated with the BindingInfo or a nullptr if not present.
Definition BindingInfo.hpp:83
void addend(int64_t addend)
Definition BindingInfo.hpp:126
BindingInfo & operator=(const BindingInfo &other)
int64_t addend() const
Value added to the segment's virtual address when bound.
Definition BindingInfo.hpp:122
Definition DyldChainedFixupsCreator.hpp:41
Class which represents a library dependency.
Definition DylibCommand.hpp:34
Class which represents a LoadCommand::TYPE::SEGMENT / LoadCommand::TYPE::SEGMENT_64 command.
Definition SegmentCommand.hpp:50
Class that represents a Symbol in a Mach-O file.
Definition MachO/Symbol.hpp:47
Namespace related to the LIEF's Mach-O module.
Definition Abstract/Header.hpp:36
@ UNKNOWN
Definition MachO/enums.hpp:24
LIEF namespace.
Definition Abstract/Binary.hpp:39
#define LIEF_API
Definition visibility.h:41