RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
|
A class that provides a general interface to setting up generation for a format. More...
#include <format.h>
Public Member Functions | |
virtual bool | AddSupplementaryOutputFormat (std::string subformat) |
If the output format actually drives multiple output formats (resource file, apple double, etc.), specify multiple types, return false if unknown. | |
virtual void | SetOptions (std::map< std::string, std::string > &options) |
Passes command line parameters as settings over to format object. | |
std::optional< std::string > | FetchOption (std::map< std::string, std::string > &options, std::string name) |
Convenience method to look up option by name. | |
std::string | FetchOption (std::map< std::string, std::string > &options, std::string name, std::string default_value) |
Convenience method to look up option by name, returning default value if name is missing. | |
std::optional< offset_t > | FetchIntegerOption (std::map< std::string, std::string > &options, std::string name) |
Convenience method to look up option by name and convert it to integer. | |
virtual void | SetModel (std::string model) |
Sets the way memory is organized, typically modifying a built-in script. | |
virtual void | SetLinkScript (std::string script_file, std::map< std::string, std::string > &options) |
Selects a script file to use for linking. | |
virtual void | ProcessModule (Linker::Module &object) |
Processes the module object and initializes format fields. | |
virtual void | CalculateValues () |
Intermediate step between processing module and generating output file to set up headers and management sections It is expected that after a module is processed, additional steps are required to evaluate the final values of the fields. | |
virtual void | GenerateFile (std::string filename, Linker::Module &module) |
The main function that handles processing, calculating and generating the final image. | |
virtual std::string | GetDefaultExtension (Linker::Module &module, std::string filename) |
Appends a default extension to the filename. | |
virtual std::string | GetDefaultExtension (Linker::Module &module) |
Provides a default filename for the output file. | |
virtual bool | FormatSupportsSegmentation () const |
Whether the format supports multiple segments. | |
virtual bool | FormatIs16bit () const |
Whether the format is 16-bit or not. | |
virtual bool | FormatIsLinear () const |
Whether the address space is linear or segmented. | |
virtual bool | FormatSupportsResources () const |
Whether the format supports resources. | |
virtual bool | FormatSupportsLibraries () const |
Whether the format supports libraries. | |
virtual unsigned | FormatAdditionalSectionFlags (std::string section_name) const |
Public Member Functions inherited from Linker::Format | |
Format (offset_t file_offset=0) | |
virtual void | Clear () |
Resets all fields to their default values, deallocate memory. | |
virtual void | ReadFile (Reader &in)=0 |
Loads file into memory. | |
virtual void | WriteFile (Writer &out)=0 |
Stores data in memory to file. | |
virtual void | Dump (Dumper::Dumper &dump) |
Display file contents in a nice manner. | |
Additional Inherited Members | |
Public Attributes inherited from Linker::Format | |
offset_t | file_offset |
A class that provides a general interface to setting up generation for a format.
|
virtual |
If the output format actually drives multiple output formats (resource file, apple double, etc.), specify multiple types, return false if unknown.
Reimplemented in Apple::MacDriver.
|
virtual |
Intermediate step between processing module and generating output file to set up headers and management sections It is expected that after a module is processed, additional steps are required to evaluate the final values of the fields.
Reimplemented in AOut::AOutFormat, Binary::GenericBinaryFormat, DOS16M::BWFormat, COFF::COFFFormat, DigitalResearch::CPM68KFormat, DigitalResearch::CPM86Format, DigitalResearch::CPM8KFormat, SeychellDOS32::AdamFormat, Apple::OMFFormat, X68000::HUFormat, Amiga::HunkFormat, Microsoft::LEFormat, Apple::AppleSingleDouble, Apple::ResourceFork::GenericResource, Apple::ResourceFork::JumpTableCodeResource, Apple::ResourceFork::CodeResource, MINIX::MINIXFormat, Microsoft::MZFormat, Microsoft::NEFormat, PharLap::MPFormat, PharLap::P3Format::Flat, PharLap::P3Format::MultiSegmented, and Ergo::XPFormat.
|
virtual |
Whether the format is 16-bit or not.
This is needed for the ELF parser which can not distinguish between the 8086 and 80386 backends.
Reimplemented in Binary::BinaryFormat, DOS16M::BWFormat, DigitalResearch::CPM86Format, MINIX::MINIXFormat, Microsoft::MZFormat, and Microsoft::NEFormat.
|
virtual |
Whether the address space is linear or segmented.
This is needed to determine whether symbol relocations are absolute addresses or offsets within their own segments. Typically, Intel 8086 backends are non-linear, the others are linear.
|
virtual |
Whether the format supports libraries.
Reimplemented in Microsoft::LEFormat, and Microsoft::NEFormat.
|
virtual |
Whether the format supports resources.
Formats such as NE, LE/LX, PE and the Macintosh classic support including resources in the final binary. To simplify writing resources, the ELF parser permits incorporating them directly in the binary image as $$RSRC$_<type>$<id>.
Reimplemented in Apple::AppleSingleDouble, Apple::ResourceFork, and Apple::MacDriver.
|
virtual |
Whether the format supports multiple segments.
This is typically true for Intel 8086 targets and false for non-Intel targets. The ELF parser uses this to provide extended relocations, including the following:
Reimplemented in Binary::BinaryFormat, DOS16M::BWFormat, DigitalResearch::CPM86Format, DigitalResearch::CPM8KFormat, Microsoft::LEFormat, Microsoft::MZFormat, Microsoft::NEFormat, and PharLap::P3Format.
|
virtual |
The main function that handles processing, calculating and generating the final image.
Reimplemented in AOut::AOutFormat, Binary::GenericBinaryFormat, COFF::COFFFormat, DigitalResearch::CPM68KFormat, DigitalResearch::CPM86Format, DigitalResearch::CPM8KFormat, X68000::HUFormat, Amiga::HunkFormat, Microsoft::LEFormat, Apple::AppleSingleDouble, Apple::ResourceFork, Apple::MacBinary, Apple::MacDriver, MINIX::MINIXFormat, Microsoft::MZFormat, and Microsoft::NEFormat.
|
virtual |
Provides a default filename for the output file.
Typically a.out or some other extension, such as a.exe.
Reimplemented in Binary::UZIFormat, Binary::UZI280Format, AOut::AOutFormat, Amiga::HunkFormat, Apple::AppleSingleDouble, Apple::ResourceFork, and MINIX::MINIXFormat.
|
virtual |
Appends a default extension to the filename.
A typical behavior would be to append .exe at the end of the filename. The default action is to leave it intact.
Reimplemented in Binary::CommodoreFormat, Binary::FLEXFormat, Binary::UZIFormat, Binary::UZI280Format, AOut::AOutFormat, Binary::GenericBinaryFormat, DOS16M::BWFormat, COFF::COFFFormat, DigitalResearch::CPM68KFormat, DigitalResearch::CPM86Format, DigitalResearch::CPM8KFormat, GEOS::GeodeFormat, X68000::HUFormat, Microsoft::LEFormat, Microsoft::MZFormat, Microsoft::NEFormat, Microsoft::PEFormat, PharLap::MPFormat, PharLap::P3Format, PMODE::PMW1Format, and Ergo::XPFormat.
|
virtual |
Processes the module object and initializes format fields.
Reimplemented in Binary::AtariFormat, Binary::CommodoreFormat, Binary::UZIFormat, AOut::AOutFormat, Binary::GenericBinaryFormat, Binary::BinaryFormat, DOS16M::BWFormat, COFF::COFFFormat, DigitalResearch::CPM68KFormat, DigitalResearch::CPM86Format, DigitalResearch::CPM8KFormat, X68000::HUFormat, Amiga::HunkFormat, Microsoft::LEFormat, Apple::AppleSingleDouble, Apple::ResourceFork::GenericResource, Apple::ResourceFork::JumpTableCodeResource, Apple::ResourceFork::CodeResource, MINIX::MINIXFormat, Microsoft::MZFormat, Microsoft::NEFormat, PharLap::MPFormat, PharLap::P3Format::Flat, and PharLap::P3Format::MultiSegmented.
|
virtual |
Selects a script file to use for linking.
Reimplemented in Apple::AppleSingleDouble, and Apple::MacDriver.
|
virtual |
Sets the way memory is organized, typically modifying a built-in script.
Reimplemented in Binary::BinaryFormat, DigitalResearch::CPM86Format, Apple::AppleSingleDouble, Apple::ResourceFork, Apple::MacDriver, Microsoft::MZFormat, and Microsoft::NEFormat.
|
virtual |
Passes command line parameters as settings over to format object.
Reimplemented in AOut::AOutFormat, Binary::GenericBinaryFormat, DOS16M::BWFormat, COFF::COFFFormat, DigitalResearch::CPM68KFormat, DigitalResearch::CPM86Format, DigitalResearch::CPM8KFormat, X68000::HUFormat, Amiga::HunkFormat, Microsoft::LEFormat, Apple::AppleSingleDouble, Apple::ResourceFork, Apple::MacDriver, MINIX::MINIXFormat, Microsoft::MZFormat, Microsoft::NEFormat, PharLap::MPFormat, and PharLap::P3Format.