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::Contents>
code =
nullptr;
109 std::shared_ptr<Linker::Contents>
data =
nullptr;
122 operator size_t()
const;
136 LIBRARY_START = 0x0040,
137 OBJECT_START = 0x0080,
153 std::vector<Symbol> symbols;
195 void Clear()
override;
210 template <
typename SizeType>
211 static offset_t CDOS68K_MeasureRelocations(std::map<uint32_t, SizeType>
relocations)
215 offset_t last_relocation = 0;
218 offset_t difference = it.first - last_relocation;
219 if(difference != 0 && difference <= 0x7C)
223 else if(difference < 0x100)
227 else if(difference < 0x10000)
239 template <
typename SizeType>
243 offset_t last_relocation = 0;
246 offset_t difference = it.first - last_relocation;
247 uint8_t highbit = it.second == 2 ? 0x80 : 0x00;
248 if(difference != 0 && difference <= 0x7C)
252 else if(difference < 0x100)
257 else if(difference < 0x10000)
267 last_relocation = it.first;
272 template <
typename SizeType,
typename Format>
280 size_t size = (
byte & 0x80) ? 2 : 4;
286 else if(
byte <= 0x7C)
290 else if(
byte == 0x7D)
294 else if(
byte == 0x7E)
302 relocations[offset] = SizeType::Create(size, offset, format);
306 offset_t MeasureRelocations()
const;
329 InitializeFields(noreloc, reloc);
345 std::shared_ptr<const Linker::Segment>
CodeSegment()
const;
349 std::shared_ptr<const Linker::Segment>
DataSegment()
const;
351 unsigned FormatAdditionalSectionFlags(std::string section_name)
const override;
353 static std::vector<Linker::OptionDescription<void> *> ParameterNames;
356 std::shared_ptr<Linker::OptionCollector>
GetOptions()
override;
358 void SetOptions(std::map<std::string, std::string>& options)
override;
360 void OnNewSegment(std::shared_ptr<Linker::Segment> segment)
override;
362 void CreateDefaultSegments();
An abstract interface that separates structure and presentation of the data inside a file.
Definition dumper.h:773
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:474
Documents and handles command line options.
Definition options.h:306
A helper class, encapsulating functionality needed to import binary data.
Definition reader.h:20
uint64_t ReadUnsigned(size_t bytes, EndianType endiantype)
Read an unsigned word.
Definition reader.cc:157
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