16#ifndef LIEF_MACHO_EXPORT_INFO_COMMAND_H
17#define LIEF_MACHO_EXPORT_INFO_COMMAND_H
22#include "LIEF/visibility.h"
23#include "LIEF/enums.hpp"
24#include "LIEF/Object.hpp"
44 enum class KIND: uint64_t {
46 THREAD_LOCAL_KIND = 0x01u,
50 enum class FLAGS: uint64_t {
51 WEAK_DEFINITION = 0x04u,
53 STUB_AND_RESOLVER = 0x10u
56 using flag_list_t = std::vector<FLAGS>;
59 ExportInfo(uint64_t address, uint64_t flags, uint64_t offset = 0) :
80 void flags(uint64_t flags) {
88 bool has(FLAGS flag)
const;
92 static constexpr auto MASK = uint64_t(3);
93 return KIND(flags_ & MASK);
96 uint64_t other()
const {
104 void address(uint64_t addr) {
110 return symbol() !=
nullptr;
126 const Symbol* alias()
const {
133 return alias_location_;
136 return alias_location_;
139 ~ExportInfo()
override =
default;
141 void accept(
Visitor& visitor)
const override;
143 LIEF_API
friend std::ostream& operator<<(std::ostream& os,
const ExportInfo& export_info);
146 uint64_t node_offset_ = 0;
148 uint64_t address_ = 0;
150 Symbol* symbol_ =
nullptr;
153 DylibCommand* alias_location_ =
nullptr;
156LIEF_API
const char* to_string(ExportInfo::KIND kind);
157LIEF_API
const char* to_string(ExportInfo::FLAGS flags);
162ENABLE_BITMASK_OPERATORS(LIEF::MachO::ExportInfo::FLAGS);
Class used to parse a single binary (i.e. non-FAT)
Definition BinaryParser.hpp:73
Class which represents a MachO binary.
Definition MachO/Binary.hpp:73
Class which represents a library dependency.
Definition DylibCommand.hpp:34
Class that provides an interface over the Dyld export info.
Definition ExportInfo.hpp:38
bool has_symbol() const
Check if a symbol is associated with this export.
Definition ExportInfo.hpp:109
const Symbol * symbol() const
MachO::Symbol associated with this export or a nullptr if no symbol.
Definition ExportInfo.hpp:114
uint64_t flags() const
Some information (ExportInfo::FLAGS) about the export. (like weak export, reexport,...
Definition ExportInfo.hpp:76
bool has(FLAGS flag) const
Check if the current entry contains the provided ExportInfo::FLAGS.
KIND kind() const
The export's kind (regular, thread local, absolute, ...)
Definition ExportInfo.hpp:91
DylibCommand * alias_library()
If the export is a ExportInfo::FLAGS::REEXPORT, this returns the (optional) library (MachO::DylibComm...
Definition ExportInfo.hpp:132
flag_list_t flags_list() const
The export flags() as a list.
uint64_t address() const
The address of the export.
Definition ExportInfo.hpp:101
uint64_t node_offset() const
Original offset in the export Trie.
Definition ExportInfo.hpp:70
Symbol * alias()
If the export is a ExportInfo::FLAGS::REEXPORT, this returns the (optional) MachO::Symbol.
Definition ExportInfo.hpp:123
Class that represents a Symbol in a Mach-O file.
Definition MachO/Symbol.hpp:47
This class represents a symbol in an executable format.
Definition Abstract/Symbol.hpp:28
Definition Visitor.hpp:219
LIEF namespace.
Definition Abstract/Binary.hpp:32