8#include "../linker/module.h"
9#include "../linker/options.h"
10#include "../linker/segment.h"
11#include "../linker/segment_manager.h"
12#include "../linker/writer.h"
262 static const std::map<uint32_t, MachineType> MACHINE_TYPES;
281 virtual offset_t GetAddress()
const = 0;
282 virtual size_t GetSize()
const = 0;
283 virtual size_t GetEntrySize()
const = 0;
295 static constexpr uint16_t
R_ABS = 0;
320 offset_t address = 0;
321 uint32_t symbol_index = 0;
323 uint32_t information = 0;
326 : coff_variant(coff_variant), cpu_type(cpu_type)
332 offset_t GetAddress()
const override;
334 size_t GetSize()
const override;
336 size_t GetEntrySize()
const override;
353 static constexpr uint16_t R_Z80_IMM8 = 0x22;
354 static constexpr uint16_t R_Z80_IMM16 = 0x01;
355 static constexpr uint16_t R_Z80_IMM24 = 0x33;
356 static constexpr uint16_t R_Z80_IMM32 = 0x17;
357 static constexpr uint16_t R_Z80_OFF8 = 0x32;
358 static constexpr uint16_t R_Z80_JR = 0x02;
360 static constexpr uint16_t R_Z8K_IMM4L = 0x23;
361 static constexpr uint16_t R_Z8K_IMM4H = 0x24;
362 static constexpr uint16_t R_Z8K_DISP7 = 0x25;
363 static constexpr uint16_t R_Z8K_IMM8 = 0x22;
364 static constexpr uint16_t R_Z8K_IMM16 = 0x01;
365 static constexpr uint16_t R_Z8K_REL16 = 0x04;
366 static constexpr uint16_t R_Z8K_IMM32 = 0x11;
367 static constexpr uint16_t R_Z8K_JR = 0x02;
368 static constexpr uint16_t R_Z8K_CALLR = 0x05;
370 static constexpr uint16_t R_W65_ABS8 = 0x01;
371 static constexpr uint16_t R_W65_ABS16 = 0x02;
372 static constexpr uint16_t R_W65_ABS24 = 0x03;
373 static constexpr uint16_t R_W65_ABS8S8 = 0x04;
374 static constexpr uint16_t R_W65_ABS8S16 = 0x05;
375 static constexpr uint16_t R_W65_ABS16S8 = 0x06;
376 static constexpr uint16_t R_W65_ABS16S16 = 0x07;
377 static constexpr uint16_t R_W65_PCR8 = 0x08;
378 static constexpr uint16_t R_W65_PCR16 = 0x09;
379 static constexpr uint16_t R_W65_DP = 0x0A;
411 offset_t GetAddress()
const override;
413 size_t GetSize()
const override;
415 size_t GetEntrySize()
const override;
461 bool IsExternal()
const;
520 std::shared_ptr<Linker::Image>
image;
529 static constexpr uint32_t
TEXT = 0x0020;
531 static constexpr uint32_t
DATA = 0x0040;
533 static constexpr uint32_t
BSS = 0x0080;
640 operator size_t()
const;
655 std::unique_ptr<Linker::Buffer> buffer =
nullptr;
658 : buffer(std::make_unique<Linker::Buffer>(size))
662 uint32_t
GetSize()
const override;
718 uint32_t
GetSize()
const override;
756 uint32_t
GetSize()
const override;
781 uint32_t code_size = 0;
782 uint32_t data_size = 0;
783 uint32_t bss_size = 0;
784 uint32_t symbol_table_size = 0;
785 uint32_t entry_address = 0;
786 uint32_t code_relocation_size = 0;
787 uint32_t data_relocation_size = 0;
789 uint32_t
GetSize()
const override;
810 uint32_t bss_address;
814 uint32_t cpr_mask[4];
823 uint32_t
GetSize()
const override;
843 static constexpr uint16_t OMAGIC = 0x0107;
844 static constexpr uint16_t NMAGIC = 0x0108;
845 static constexpr uint16_t ZMAGIC = 0x010B;
850 static constexpr uint16_t SYM_STAMP = 0x030D;
900 uint32_t
GetSize()
const override;
1045 uint8_t shared_memory_page = 0;
1053 uint32_t
GetSize()
const override;
1064 void Clear()
override;
1087 bool DetectCpuType(::EndianType expected);
1089 void DetectCpuType();
1112 void SetupOptions(std::shared_ptr<Linker::OutputFormat> format)
override;
1114 bool option_segmentation =
false;
1120 std::string segment_prefix();
1122 std::string segment_of_prefix();
1127 std::string segmented_address_prefix();
1131 std::string segment_difference_prefix();
1160 InitializeFields(stub);
1231 unsigned FormatAdditionalSectionFlags(std::string section_name)
const override;
1233 static std::vector<Linker::OptionDescription<void> *> ParameterNames;
1236 std::shared_ptr<Linker::OptionCollector>
GetOptions()
override;
1238 void SetOptions(std::map<std::string, std::string>& options)
override;
1270 void OnNewSegment(std::shared_ptr<Linker::Segment> segment)
override;
1272 void CreateDefaultSegments();
1279 std::shared_ptr<Linker::Segment>
GetSegment(std::shared_ptr<Section>& section);
1281 std::shared_ptr<Linker::Segment> GetCodeSegment();
1283 std::shared_ptr<Linker::Segment> GetDataSegment();
1285 std::shared_ptr<Linker::Segment> GetBssSegment();
An abstract interface that separates structure and presentation of the data inside a file.
Definition dumper.h:586
A brief record, such as a relocation or imported library.
Definition dumper.h:506
A record that represents a region within the file.
Definition dumper.h:485
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
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