5#include "../dumper/dumper.h"
6#include "../linker/options.h"
7#include "../linker/segment_manager.h"
25 InitializeFields(stub);
37 unsigned FormatAdditionalSectionFlags(std::string section_name)
const override;
52 FLAG_TRANSPARENT = 0x8000,
57 uint32_t total_length;
59 AbstractSegment(
unsigned access = TYPE_DATA,
unsigned flags = 0, uint32_t total_length = 0)
60 : access(access_type(access)), flags(flag_type(flags)), total_length(total_length)
99 std::shared_ptr<Linker::Segment> image;
101 Segment(std::shared_ptr<Linker::Segment> segment,
unsigned access = TYPE_DATA,
unsigned flags = 0)
116 DummySegment(uint32_t total_length,
unsigned access = TYPE_DATA,
unsigned flags = 0)
158 bool option_force_relocations =
true;
162 EXP_FLAG_RELOCATABLE = 0x0001,
164 exp_flag_type exp_flags = exp_flag_type(0);
168 OPTION_RELOCATIONS = 0x1000,
170 option_type options = option_type(0);
172 std::map<uint16_t, std::set<uint16_t> > relocations;
174 offset_t MeasureRelocations()
const;
176 std::shared_ptr<Linker::OptionCollector>
GetOptions()
override;
178 void SetOptions(std::map<std::string, std::string>& options)
override;
180 offset_t file_size = 0;
181 offset_t min_extra = 0;
182 offset_t max_extra = 0;
183 uint16_t ss = 0, sp = 0, cs = 0, ip = 0, relocsel = 0;
184 uint16_t runtime_gdt_length = 0xFFFF;
185 uint16_t version = 0;
186 uint32_t next_header_offset = 0;
187 uint32_t debug_info_offset = 0;
188 uint16_t first_selector = 0x0080;
189 uint32_t private_xm = 0;
190 uint16_t ext_reserve = 0;
191 uint16_t transparent_stack = 0;
192 uint32_t program_size = 0;
193 uint8_t default_memory_strategy = 0;
194 uint16_t transfer_buffer_size = 0;
195 std::string exp_name;
199 std::vector<std::unique_ptr<AbstractSegment>> segments;
200 std::map<std::shared_ptr<Linker::Segment>,
size_t> segment_indices;
201 int default_data = 0;
203 void OnNewSegment(std::shared_ptr<Linker::Segment> segment)
override;
209 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
Helper class that contains the options interpreted by the format.
Definition options.h:308
Documents and handles command line options.
Definition options.h:196
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