5#include "../dumper/dumper.h"
6#include "../linker/segment_manager.h"
23 unsigned FormatAdditionalSectionFlags(std::string section_name)
const override;
38 FLAG_TRANSPARENT = 0x8000,
43 uint32_t total_length;
45 AbstractSegment(
unsigned access = TYPE_DATA,
unsigned flags = 0, uint32_t total_length = 0)
46 : access(access_type(access)), flags(flag_type(flags)), total_length(total_length)
85 std::shared_ptr<Linker::Segment> image;
87 Segment(std::shared_ptr<Linker::Segment> segment,
unsigned access = TYPE_DATA,
unsigned flags = 0)
102 DummySegment(uint32_t total_length,
unsigned access = TYPE_DATA,
unsigned flags = 0)
144 bool option_force_relocations =
true;
148 EXP_FLAG_RELOCATABLE = 0x0001,
150 exp_flag_type exp_flags = exp_flag_type(0);
154 OPTION_RELOCATIONS = 0x1000,
156 option_type options = option_type(0);
158 std::map<uint16_t, std::set<uint16_t> > relocations;
160 offset_t MeasureRelocations()
const;
162 void SetOptions(std::map<std::string, std::string>& options)
override;
164 offset_t file_size = 0;
165 offset_t min_extra = 0;
166 offset_t max_extra = 0;
167 uint16_t ss = 0, sp = 0, cs = 0, ip = 0, relocsel = 0;
168 uint16_t runtime_gdt_length = 0xFFFF;
169 uint16_t version = 0;
170 uint32_t next_header_offset = 0;
171 uint32_t debug_info_offset = 0;
172 uint16_t first_selector = 0x0080;
173 uint32_t private_xm = 0;
174 uint16_t ext_reserve = 0;
175 uint16_t transparent_stack = 0;
176 uint32_t program_size = 0;
177 uint8_t default_memory_strategy = 0;
178 uint16_t transfer_buffer_size = 0;
179 std::string exp_name;
183 std::vector<std::unique_ptr<AbstractSegment>> segments;
184 std::map<std::shared_ptr<Linker::Segment>,
size_t> segment_indices;
185 int default_data = 0;
187 void OnNewSegment(std::shared_ptr<Linker::Segment> segment)
override;
193 size_t GetDefaultDataIndex();
An abstract interface that separates structure and presentation of the data inside a file.
Definition dumper.h:586
Encodes an object module file as a collection of sections, symbols and relocations.
Definition module.h:24
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