|
RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
|
Encodes an object module file as a collection of sections, symbols and relocations. More...
#include <module.h>
Public Types | |
| enum | cpu_type { NONE , I80 , I86 , I386 , X86_64 , M6800 , M6809 , M68K , MOS6502 , W65K , Z8K , PPC , PPC64 , ARM , ARM64 , PDP11 , MIPS , SPARC , SH } |
| Supported CPU types. | |
Public Member Functions | |
| Module (std::string file_name="") | |
| bool | HasSymbolDefinition (const SymbolDefinition &symbol) |
| void | SetupOptions (char special_char, std::shared_ptr< OutputFormat > output_format, std::shared_ptr< const InputFormat > input_format) |
| Initializes the reader for linking purposes. | |
| bool | AddLocalSymbol (std::string name, Location location) |
| Adds an internal symbol. | |
| bool | AddGlobalSymbol (std::string name, Location location) |
| Adds and processes exported symbol for extended syntax. | |
| bool | AddWeakSymbol (std::string name, Location location) |
| Adds a weakly bound symbol. | |
| bool | AddCommonSymbol (SymbolDefinition symbol) |
| Adds a common symbol. | |
| bool | AddLocalCommonSymbol (SymbolDefinition symbol) |
| Adds a local common symbol. | |
| void | AddImportedSymbol (SymbolName name) |
| Adds an imported symbol (Microsoft format: library name + symbol name + ordinal/hint) | |
| void | AddExportedSymbol (ExportedSymbolName name, Location symbol) |
| Adds an exported symbol (Microsoft format: library name + symbol name + ordinal/hint) | |
| bool | AddUndefinedSymbol (std::string symbol_name) |
| Processes undefined symbol for extended syntax. | |
| void | AddRelocation (Relocation relocation) |
| Adds and processes relocation for extended syntax. | |
| const std::vector< SymbolName > & | GetImportedSymbols () const |
| Retrieves list of all imported symbols. | |
| const std::map< ExportedSymbolName, Location > & | GetExportedSymbols () const |
| Retrieves map of all exported symbols and their locations. | |
| bool | FindLocalSymbol (std::string name, Location &location) |
| Searches for a local symbol. | |
| bool | FindGlobalSymbol (std::string name, Location &location) |
| Searches for a global or weak symbol. | |
| void | AddSection (std::shared_ptr< Section > section) |
| Adds a new section. | |
| const std::vector< std::shared_ptr< Section > > & | Sections () const |
| Retrieves list of all sections. | |
| void | DeleteSection (size_t index) |
| Deletes a specific sections. | |
| void | RemoveSections () |
| Removes all sections from internal list, without deleting them. | |
| std::shared_ptr< Section > | FindSection (std::string name) |
| Searches for a section with a specific name. | |
| std::shared_ptr< Section > | FetchSection (std::string name, unsigned default_flags) |
| Searches or creates a section with a specific name, with the assigned flags. | |
| void | ResolveLocalRelocations () |
| Attempts to resolve the local targets of all relocations. | |
| void | Append (std::shared_ptr< Section > dst, std::shared_ptr< Section > src) |
| Appends two sections by shifting all symbols locations and relocation targets in the second one. | |
| void | Append (Module &other) |
| Appends another module object, merging identically named sections. | |
| void | AllocateSymbols (std::string default_section_name=".comm") |
| All common symbols are converted to global symbols and assigned addresses within a their section (usually ".comm") | |
Public Attributes | |
| std::string | file_name |
| Stores source/destination file name. | |
| cpu_type | cpu = NONE |
| Encodes the CPU for the target. | |
| ::EndianType | endiantype = ::UndefinedEndian |
| std::vector< SymbolDefinition > | symbol_sequence |
| Sorted collection of all symbols appearing in the module, duplicates removed. | |
| std::vector< Relocation > | relocations |
| List of relocations within the module. | |
| bool | is_included = false |
| Set to true if module is included in the linking process, relevant for libraries. | |
Friends | |
| class | ModuleCollector |
Encodes an object module file as a collection of sections, symbols and relocations.
| void Module::SetupOptions | ( | char | special_char, |
| std::shared_ptr< OutputFormat > | output_format, | ||
| std::shared_ptr< const InputFormat > | input_format ) |
Initializes the reader for linking purposes.
| special_char | Most input formats do not provide support for the special requirements of the output format (such as segmentation for ELF). We work around this by introducing special name prefixes $$SEGOF$ where $ is the value of special_char. |
| output_format | The output format that will be used. This is required to know which extra special features need to be implemented (such as segmentation). |
| input_format | The input format that will be used. This is required to know which extra special features need to be implemented (such as segmentation). |