RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
|
Represents an (imported or internal) symbol name, which can be more complex than a string. More...
#include <symbol_name.h>
Classes | |
struct | LibraryMark |
Public Member Functions | |
SymbolName (std::string name) | |
Creates an internal symbol with a name. | |
SymbolName (std::string library, std::string name) | |
Creates a symbol imported via name, from a library. | |
SymbolName (std::string library, std::string name, uint16_t hint) | |
Creates a symbol imported via name and a hint, from a library. | |
SymbolName (std::string library, uint16_t ordinal) | |
Creates a symbol imported via ordinal, from a library. | |
SymbolName (std::string library, LibraryMark is_library) | |
Creates a symbol referencing the base of an imported library. | |
bool | LoadName (std::string &result) const |
Retrieves the name of the symbol, if it has one. | |
bool | LoadLibraryName (std::string &result) const |
Retrieves the name of the library, if it is imported. | |
bool | LoadOrdinalOrHint (uint16_t &result) const |
Retrieves the ordinal of symbols imported by ordinal, or the hint for imported symbols with a hint. | |
bool | GetLocalName (std::string &result) const |
For local symbols, returns the name. | |
bool | GetImportedName (std::string &result_library, std::string &result_name) const |
For symbols imported by name, returns the library and name. | |
bool | GetImportedName (std::string &result_library, std::string &result_name, uint16_t &result_hint) const |
For symbols imported by name, returns the library, name and hint (or zero if no hint is present) | |
bool | GetImportedOrdinal (std::string &result_library, uint16_t &result_ordinal) const |
For symbols imported by ordinal, returns the library and ordinal. | |
bool | GetImportedLibrary (std::string &result_library) const |
For symbols that are identified by the library name and the offset, stored in the addend. | |
bool | operator== (const SymbolName &other) const |
Compares two symbols for equality. | |
bool | operator!= (const SymbolName &other) const |
Compares two symbols for inequality. | |
Public Attributes | |
offset_t | addend = 0 |
Optional value to be added to the symbol location (TODO: not yet fully implemented) | |
Static Public Attributes | |
static LibraryMark | IsLibrary |
static SymbolName | GOT |
Symbol representing the global offset table. | |
Protected Attributes | |
std::optional< std::string > | library |
std::optional< std::string > | name |
std::optional< uint16_t > | hint |
Represents an (imported or internal) symbol name, which can be more complex than a string.
When referencing symbols, usually a string identifier is sufficient. Some output formats, in particular the NE, LE and PE formats, need to store more information with the symbol, including the library it is imported from, and potentially a 16-bit integer ordinal or hint.
|
inline |
Creates a symbol imported via name and a hint, from a library.
This is expected to be used for the PE format.
|
inline |
Creates a symbol imported via ordinal, from a library.
This is used by formats like NE, LE, PE.