RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Linker::InputFormat Class Reference

A class that provides a general interface to loading a module. More...

#include <format.h>

Inheritance diagram for Linker::InputFormat:
Linker::Format Linker::Contents AOut::AOutFormat AS86Obj::AS86ObjFormat Archive::ArchiveFormat COFF::COFFFormat ELF::ELFFormat O65::O65Format OMF::OMF51Format OMF::OMF80Format OMF::OMF86Format OMF::OMF96Format OMF::OMFFormatContainer

Public Member Functions

virtual void SetupOptions (std::shared_ptr< OutputFormat > format)
 Initializes the reader for linking purposes.
 
virtual void ProduceModule (ModuleCollector &linker, const std::shared_ptr< Reader > &rd, std::string file_name)
 Reads a file and loads the information into a module object.
 
virtual void ProduceModule (Module &module, const std::shared_ptr< Reader > &rd)
 Reads a file and loads the information into a module object, a convenience method when there is a single module generated.
 
virtual void GenerateModule (ModuleCollector &linker, std::string file_name, bool is_library=false) const
 Loads the information into a module object.
 
virtual void GenerateModule (Module &module) const
 Loads the information into a module object, a convenience method when there is a single module generated.
 
virtual bool FormatProvidesSegmentation () const
 Whether the format enables multiple x86 segments.
 
virtual bool FormatRequiresDataStreamFix () const
 Whether the generated file might contain bugs that require fixing.
 
virtual bool FormatProvidesTransitionVectors () const
 Whether the format supports generating transition vectors.
 
virtual bool FormatProvidesResources () const
 Whether the format supports resources.
 
virtual bool FormatProvidesLibraries () const
 Whether the format enables importing/exporting libraries.
 
virtual bool FormatProvidesEntryTable () const
 Whether the format supports a structure containing addresses of methods.
 
- 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 (const std::shared_ptr< Reader > &rd)=0
 Loads file into memory.
 
offset_t WriteFile (const std::shared_ptr< Writer > &wr) const override=0
 Stores data in memory to file.
 
virtual void Dump (Dumper::Dumper &dump) const
 Display file contents in a nice manner.
 
virtual void SetFileOffset (offset_t new_offset)
 Attempts to alter the offset to the first byte of the format from the beginning of the file.
 
offset_t ImageSize () const override
 Retrieves the offset of the byte after the last one belonging to this format from the first one.
 
- Public Member Functions inherited from Linker::Contents
virtual std::shared_ptr< const Image > AsImage () const
 Retrieves a randomly accessible image.
 
std::shared_ptr< Image > AsImage ()
 Retrieves a randomly accessible image.
 

Additional Inherited Members

- Public Attributes inherited from Linker::Format
offset_t file_offset
 The offset of the first byte used by this format in the file it is stored in.
 

Detailed Description

A class that provides a general interface to loading a module.

Member Function Documentation

◆ FormatProvidesEntryTable()

bool InputFormat::FormatProvidesEntryTable ( ) const
virtual

Whether the format supports a structure containing addresses of methods.

Formats such as NE, LE/LX and the Macintosh classic support an ordinal table or jump table that contains the addresses of certain methods.

◆ FormatProvidesResources()

bool InputFormat::FormatProvidesResources ( ) const
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>.

◆ FormatProvidesSegmentation()

bool InputFormat::FormatProvidesSegmentation ( ) const
virtual

Whether the format enables multiple x86 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:

  • $$SEG$<section name>
  • $$SEGOF$<symbol name>
  • $$SEGAT$<symbol name>
  • $$WRTSEG$<symbol name>$<section name>
  • $$SEGDIF$<section name>$<section name>

◆ FormatProvidesTransitionVectors()

bool InputFormat::FormatProvidesTransitionVectors ( ) const
virtual

Whether the format supports generating transition vectors.

Transition vectors are a structure containing the address of a procedure alongside the address of the start of a data area. 68K based software calls this the A5 world, accessed via the A5 register, PowerPC based software calls this the TOC or Table of Contents, accessed via GPR2.

◆ FormatRequiresDataStreamFix()

bool InputFormat::FormatRequiresDataStreamFix ( ) const
virtual

Whether the generated file might contain bugs that require fixing.

Reimplemented in COFF::COFFFormat.

◆ GenerateModule() [1/2]

void InputFormat::GenerateModule ( Module &  module) const
virtual

Loads the information into a module object, a convenience method when there is a single module generated.

Reimplemented in AOut::AOutFormat, AS86Obj::AS86ObjFormat, COFF::COFFFormat, ELF::ELFFormat, EMX::EMXAOutFormat, O65::O65Format, OMF::OMF86Format, OMF::OMF80Format, OMF::OMF51Format, OMF::OMF96Format, and OMF::OMFFormatContainer.

◆ GenerateModule() [2/2]

void InputFormat::GenerateModule ( ModuleCollector &  linker,
std::string  file_name,
bool  is_library = false 
) const
virtual

Loads the information into a module object.

Reimplemented in Archive::ArchiveFormat.

◆ SetupOptions()

void InputFormat::SetupOptions ( std::shared_ptr< OutputFormat >  format)
virtual

Initializes the reader for linking purposes.

Parameters
formatThe output format that will be used. This is required to know which extra special features need to be implemented (such as segmentation).

Reimplemented in COFF::COFFFormat, and ELF::ELFFormat.


The documentation for this class was generated from the following files: