16#ifndef LIEF_MACHO_CHAINED_BINDING_INFO_H
17#define LIEF_MACHO_CHAINED_BINDING_INFO_H
20#include "LIEF/visibility.h"
21#include "LIEF/MachO/BindingInfo.hpp"
22#include "LIEF/MachO/DyldChainedFormat.hpp"
31struct dyld_chained_ptr_arm64e_bind;
32struct dyld_chained_ptr_arm64e_auth_bind;
33struct dyld_chained_ptr_arm64e_bind24;
34struct dyld_chained_ptr_arm64e_auth_bind24;
35struct dyld_chained_ptr_64_bind;
36struct dyld_chained_ptr_32_bind;
77 void offset(uint32_t offset) {
82 return address_ + offset_;
85 void address(uint64_t address)
override {
86 offset_ = address - address_;
89 uint64_t sign_extended_addend()
const;
92 return BindingInfo::TYPES::CHAINED;
96 return info->
type() == BindingInfo::TYPES::CHAINED;
99 ~ChainedBindingInfo()
override {
103 void accept(Visitor& visitor)
const override;
106 std::ostream& operator<<(std::ostream& os,
const ChainedBindingInfo& info) {
107 os << static_cast<const BindingInfo&>(info);
113 enum class BIND_TYPES {
126 void set(
const details::dyld_chained_ptr_arm64e_bind& bind);
127 void set(
const details::dyld_chained_ptr_arm64e_auth_bind& bind);
128 void set(
const details::dyld_chained_ptr_arm64e_bind24& bind);
129 void set(
const details::dyld_chained_ptr_arm64e_auth_bind24& bind);
130 void set(
const details::dyld_chained_ptr_64_bind& bind);
131 void set(
const details::dyld_chained_ptr_32_bind& bind);
133 DYLD_CHAINED_FORMAT format_;
134 DYLD_CHAINED_PTR_FORMAT ptr_format_;
135 uint32_t offset_ = 0;
137 BIND_TYPES btypes_ = BIND_TYPES::UNKNOWN;
140 details::dyld_chained_ptr_arm64e_bind* arm64_bind_ =
nullptr;
141 details::dyld_chained_ptr_arm64e_auth_bind* arm64_auth_bind_;
142 details::dyld_chained_ptr_arm64e_bind24* arm64_bind24_;
143 details::dyld_chained_ptr_arm64e_auth_bind24* arm64_auth_bind24_;
144 details::dyld_chained_ptr_64_bind* p64_bind_;
145 details::dyld_chained_ptr_32_bind* p32_bind_;
Class used to parse a single binary (i.e. non-FAT)
Definition BinaryParser.hpp:73
Class that provides an interface over a binding operation.
Definition BindingInfo.hpp:38
TYPES
Definition BindingInfo.hpp:43
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...
Class used to rebuild a Mach-O file.
Definition MachO/Builder.hpp:54
This class represents a symbol binding operation associated with the LC_DYLD_CHAINED_FIXUPS command.
Definition ChainedBindingInfo.hpp:46
DYLD_CHAINED_PTR_FORMAT ptr_format() const
Format of the pointer.
Definition ChainedBindingInfo.hpp:68
DYLD_CHAINED_FORMAT format() const
Format of the imports.
Definition ChainedBindingInfo.hpp:63
uint64_t address() const override
Address of the binding.
Definition ChainedBindingInfo.hpp:81
BindingInfo::TYPES type() const override
The type of the binding. This type provides the origin of the binding (LC_DYLD_INFO or LC_DYLD_CHAINE...
Definition ChainedBindingInfo.hpp:91
uint32_t offset() const
Original offset in the chain of this binding.
Definition ChainedBindingInfo.hpp:73
LIEF namespace.
Definition Abstract/Binary.hpp:32