8#include "../linker/module.h"
9#include "../linker/options.h"
10#include "../linker/reader.h"
11#include "../linker/segment.h"
12#include "../linker/segment_manager.h"
13#include "../linker/writer.h"
14#include "../dumper/dumper.h"
16namespace DigitalResearch
105 std::shared_ptr<Linker::Image>
code =
nullptr;
109 std::shared_ptr<Linker::Image>
data =
nullptr;
122 operator size_t()
const;
171 void Clear()
override;
186 template <
typename SizeType>
187 static offset_t CDOS68K_MeasureRelocations(std::map<uint32_t, SizeType>
relocations)
191 offset_t last_relocation = 0;
194 offset_t difference = it.first - last_relocation;
195 if(difference != 0 && difference <= 0x7C)
199 else if(difference < 0x100)
203 else if(difference < 0x10000)
215 template <
typename SizeType>
219 offset_t last_relocation = 0;
222 offset_t difference = it.first - last_relocation;
223 uint8_t highbit = it.second == 2 ? 0x80 : 0x00;
224 if(difference != 0 && difference <= 0x7C)
228 else if(difference < 0x100)
233 else if(difference < 0x10000)
243 last_relocation = it.first;
248 template <
typename SizeType,
typename Format>
256 size_t size = (
byte & 0x80) ? 2 : 4;
262 else if(
byte <= 0x7C)
266 else if(
byte == 0x7D)
270 else if(
byte == 0x7E)
278 relocations[offset] = SizeType::Create(size, offset, format);
282 offset_t MeasureRelocations()
const;
303 InitializeFields(noreloc, reloc);
319 std::shared_ptr<const Linker::Segment>
CodeSegment()
const;
323 std::shared_ptr<const Linker::Segment>
DataSegment()
const;
325 unsigned FormatAdditionalSectionFlags(std::string section_name)
const override;
327 static std::vector<Linker::OptionDescription<void> *> ParameterNames;
330 std::shared_ptr<Linker::OptionCollector>
GetOptions()
override;
332 void SetOptions(std::map<std::string, std::string>& options)
override;
334 void OnNewSegment(std::shared_ptr<Linker::Segment> segment)
override;
336 void CreateDefaultSegments();
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:467
Documents and handles command line options.
Definition options.h:303
A helper class, encapsulating functionality needed to import binary data.
Definition reader.h:16
uint64_t ReadUnsigned(size_t bytes, EndianType endiantype)
Read an unsigned word.
Definition reader.cc:86
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
void WriteWord(size_t bytes, uint64_t value, EndianType endiantype)
Read a word.
Definition writer.cc:67