8#include "../linker/linker.h"
9#include "../linker/module.h"
10#include "../linker/segment.h"
11#include "../linker/writer.h"
65 static const std::map<uint32_t, MachineType> MACHINE_TYPES;
82 virtual offset_t GetAddress() = 0;
83 virtual size_t GetSize() = 0;
97 static const uint16_t R_Z80_IMM8 = 0x22;
98 static const uint16_t R_Z80_IMM16 = 0x01;
99 static const uint16_t R_Z80_IMM24 = 0x33;
100 static const uint16_t R_Z80_IMM32 = 0x17;
101 static const uint16_t R_Z80_OFF8 = 0x32;
102 static const uint16_t R_Z80_JR = 0x02;
104 static const uint16_t R_Z8K_IMM4L = 0x23;
105 static const uint16_t R_Z8K_IMM4H = 0x24;
106 static const uint16_t R_Z8K_DISP7 = 0x25;
107 static const uint16_t R_Z8K_IMM8 = 0x22;
108 static const uint16_t R_Z8K_IMM16 = 0x01;
109 static const uint16_t R_Z8K_REL16 = 0x04;
110 static const uint16_t R_Z8K_IMM32 = 0x11;
111 static const uint16_t R_Z8K_JR = 0x02;
112 static const uint16_t R_Z8K_CALLR = 0x05;
114 static const uint16_t R_W65_ABS8 = 0x01;
115 static const uint16_t R_W65_ABS16 = 0x02;
116 static const uint16_t R_W65_ABS24 = 0x03;
117 static const uint16_t R_W65_ABS8S8 = 0x04;
118 static const uint16_t R_W65_ABS8S16 = 0x05;
119 static const uint16_t R_W65_ABS16S8 = 0x06;
120 static const uint16_t R_W65_ABS16S16 = 0x07;
121 static const uint16_t R_W65_PCR8 = 0x08;
122 static const uint16_t R_W65_PCR16 = 0x09;
123 static const uint16_t R_W65_DP = 0x0A;
155 offset_t GetAddress()
override;
157 size_t GetSize()
override;
201 bool IsExternal()
const;
254 std::shared_ptr<Linker::Writable>
image;
288 uint32_t ActualDataSize();
366 std::unique_ptr<Linker::Buffer> buffer =
nullptr;
369 : buffer(std::make_unique<Linker::Buffer>(size))
481 uint32_t code_size = 0;
482 uint32_t data_size = 0;
483 uint32_t bss_size = 0;
484 uint32_t symbol_table_size = 0;
485 uint32_t entry_address = 0;
486 uint32_t code_relocation_size = 0;
487 uint32_t data_relocation_size = 0;
508 uint32_t bss_address;
512 uint32_t cpr_mask[4];
521 void Clear()
override;
523 void AssignMagicValue();
537 bool DetectCpuType(::EndianType expected);
539 void DetectCpuType();
549 void SetupOptions(std::shared_ptr<Linker::OutputFormat> format)
override;
551 bool option_segmentation =
false;
557 std::string segment_prefix();
559 std::string segment_of_prefix();
564 std::string segmented_address_prefix();
568 std::string segment_difference_prefix();
632 std::shared_ptr<Linker::Segment>
stack;
652 unsigned FormatAdditionalSectionFlags(std::string section_name)
const override;
654 static std::shared_ptr<COFFFormat> CreateWriter(format_type
type);
656 using LinkerManager::SetLinkScript;
658 void SetOptions(std::map<std::string, std::string>& options)
override;
663 FLAG_NO_RELOCATIONS = 0x0001,
664 FLAG_EXECUTABLE = 0x0002,
665 FLAG_NO_LINE_NUMBERS = 0x0004,
666 FLAG_NO_SYMBOLS = 0x0008,
667 FLAG_32BIT_LITTLE_ENDIAN = 0x0100,
668 FLAG_32BIT_BIG_ENDIAN = 0x0200,
676 void OnNewSegment(std::shared_ptr<Linker::Segment> segment)
override;
678 void CreateDefaultSegments();
685 std::shared_ptr<Linker::Segment>
GetSegment(std::unique_ptr<Section>& section);
687 std::shared_ptr<Linker::Segment> GetCodeSegment();
689 std::shared_ptr<Linker::Segment> GetDataSegment();
691 std::shared_ptr<Linker::Segment> GetBssSegment();
A class to control the output of a file analysis.
Definition dumper.h:550
A brief record, such as a relocation or imported library.
Definition dumper.h:476
A record that represents a region within the file.
Definition dumper.h:455
A helper class to collect sections into segments.
Definition linker.h:19
Encodes an object module file as a collection of sections, symbols and relocations.
Definition module.h:20
A helper class, encapsulating functionality needed to import binary data.
Definition reader.h:16
A helper class, encapsulating functionality needed to export binary data.
Definition writer.h:15