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;
133 static std::unique_ptr<LoadCommand> Read(
const std::shared_ptr<Linker::Reader>& rd);
135 virtual void ReadFile(
const std::shared_ptr<Linker::Reader>& rd);
136 virtual void WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const;
138 virtual void Read(
const std::shared_ptr<Linker::Reader>& rd, offset_t size) = 0;
139 virtual void Write(
const std::shared_ptr<Linker::Writer>& wr)
const;
140 virtual offset_t GetSize()
const = 0;
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;
174 static Section Read(
const std::shared_ptr<Linker::Reader>& rd,
int wordsize);
175 void Write(
const std::shared_ptr<Linker::Writer>& rd,
int wordsize)
const;
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;
191 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
192 void WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
194 void Read(
const std::shared_ptr<Linker::Reader>& rd, offset_t size)
override;
195 void Write(
const std::shared_ptr<Linker::Writer>& wr)
const override;
196 offset_t GetSize()
const override;