7#include "../dumper/dumper.h"
8#include "../linker/module.h"
9#include "../linker/segment_manager.h"
10#include "../linker/reader.h"
24 ::EndianType endiantype = ::UndefinedEndian;
47 cpu_type cpu = cpu_type(0);
48 uint32_t cpu_subtype = 0;
49 uint32_t file_type = 0;
50 uint32_t commands_size = 0;
56 enum command_type : uint32_t
58 REQ_DYLD = 0x80000000,
83 _LOAD_WEAK_DYLIB = 24,
89 SEGMENT_SPLIT_INFO = 30,
94 _LOAD_UPWARD_DYLIB = 35,
95 VERSION_MIN_MACOSX = 36,
96 VERSION_MIN_IPHONEOS = 37,
98 DYLD_ENVIRONMENT = 39,
102 DYLIB_CODE_SIGN_DRS = 43,
103 ENCRYPTION_INFO_64 = 44,
105 LINKER_OPTIMIZATION_HINT = 46,
106 VERSION_MIN_TVOS = 47,
107 VERSION_MIN_WATCHOS = 48,
110 _DYLD_EXPORTS_TRIE = 51,
111 _DYLD_CHAINED_FIXUPS = 52,
114 LOAD_WEAK_DYLIB = _LOAD_WEAK_DYLIB | REQ_DYLD,
115 RPATH = _RPATH | REQ_DYLD,
116 REEXPORT_DYLIB = _REEXPORT_DYLIB | REQ_DYLD,
117 DYLD_INFO_ONLY = DYLD_INFO | REQ_DYLD,
118 LOAD_UPWARD_DYLIB = _LOAD_UPWARD_DYLIB | REQ_DYLD,
119 MAIN = _MAIN | REQ_DYLD,
120 DYLD_EXPORTS_TRIE = _DYLD_EXPORTS_TRIE | REQ_DYLD,
121 DYLD_CHAINED_FIXUPS = _DYLD_CHAINED_FIXUPS | REQ_DYLD,
122 FILESET_ENTRY = _FILESET_ENTRY | REQ_DYLD,
124 command_type command;
140 virtual offset_t GetSize()
const = 0;
142 std::vector<std::unique_ptr<LoadCommand>> load_commands;
152 std::shared_ptr<Linker::Image> command_image;
156 offset_t GetSize()
const override;
163 std::string segment_name;
164 uint64_t address = 0;
165 uint64_t memory_size = 0;
167 uint32_t align_shift = 0;
168 uint32_t relocation_offset = 0;
169 uint32_t relocation_count = 0;
171 uint32_t reserved1 = 0;
172 uint32_t reserved2 = 0;
182 uint64_t address = 0;
183 uint64_t memory_size = 0;
185 uint64_t file_size = 0;
186 uint32_t max_protection = 0;
187 uint32_t init_protection = 0;
189 std::vector<Section> sections;
196 offset_t GetSize()
const override;
211 MachOFormat::cpu_type cpu = MachOFormat::cpu_type(0);
212 uint32_t cpu_subtype = 0;
216 std::shared_ptr<Linker::Image> image;
221 std::vector<Entry> entries;
An abstract interface that separates structure and presentation of the data inside a file.
Definition dumper.h:586
A helper class, encapsulating functionality needed to import binary data.
Definition reader.h:16
A helper class to collect sections into segments.
Definition segment_manager.h:32
A helper class, encapsulating functionality needed to export binary data.
Definition writer.h:15