16#ifndef LIEF_MACHO_BINDING_INFO_H
17#define LIEF_MACHO_BINDING_INFO_H
65 return segment_ !=
nullptr;
79 return library_ !=
nullptr;
93 return symbol_ !=
nullptr;
115 return library_ordinal_;
119 library_ordinal_ = ordinal;
132 return is_weak_import_;
136 is_weak_import_ = val;
149 static_assert(std::is_base_of<BindingInfo, T>::value,
150 "Require BindingInfo inheritance");
151 if (T::classof(
this)) {
152 return static_cast<const T*
>(
this);
159 return const_cast<T*
>(
static_cast<const BindingInfo*
>(
this)->cast<T>());
167 Symbol* symbol_ =
nullptr;
168 int32_t library_ordinal_ = 0;
170 bool is_weak_import_ =
false;
172 uint64_t address_ = 0;
Class used to parse a single binary (i.e. non-FAT).
Definition BinaryParser.hpp:78
DylibCommand * library()
Definition BindingInfo.hpp:87
~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:92
const T * cast() const
Definition BindingInfo.hpp:148
Symbol * symbol()
Definition BindingInfo.hpp:101
bool has_segment() const
Check if a MachO::SegmentCommand is associated with this binding.
Definition BindingInfo.hpp:64
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:70
int32_t library_ordinal() const
Definition BindingInfo.hpp:114
friend class BinaryParser
Definition BindingInfo.hpp:42
BindingInfo(BindingInfo &&) noexcept=default
BindingInfo(const BindingInfo &other)
friend class DyldChainedFixupsCreator
Definition BindingInfo.hpp:43
bool has_library() const
Check if a MachO::DylibCommand is tied with the BindingInfo.
Definition BindingInfo.hpp:78
virtual void address(uint64_t addr)
Definition BindingInfo.hpp:110
void set_weak_import(bool val=true)
Definition BindingInfo.hpp:135
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:98
TYPES
Definition BindingInfo.hpp:46
void library_ordinal(int32_t ordinal)
Definition BindingInfo.hpp:118
T * cast()
Definition BindingInfo.hpp:158
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:106
void swap(BindingInfo &other) noexcept
bool is_weak_import() const
Definition BindingInfo.hpp:131
SegmentCommand * segment()
Definition BindingInfo.hpp:73
const DylibCommand * library() const
MachO::DylibCommand associated with the BindingInfo or a nullptr if not present.
Definition BindingInfo.hpp:84
void addend(int64_t addend)
Definition BindingInfo.hpp:127
BindingInfo & operator=(const BindingInfo &other)
int64_t addend() const
Value added to the segment's virtual address when bound.
Definition BindingInfo.hpp:123
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:51
Class that represents a Symbol in a Mach-O file.
Definition MachO/Symbol.hpp:47
Definition Visitor.hpp:212
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:40
#define LIEF_API
Definition visibility.h:43