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

Represents a symbol definition. More...

#include <symbol_definition.h>

Public Types

enum  binding_type {
  Undefined , Local , Global , Weak ,
  Common , LocalCommon
}
 

Public Member Functions

bool operator== (const SymbolDefinition &other) const
 
bool IsLocal () const
 
bool IsCommon () const
 
bool IsAllocated () const
 
bool Displace (const Displacement &displacement)
 Recalculates the location after a section has moved.
 

Static Public Member Functions

static SymbolDefinition CreateUndefined (std::string name, offset_t size=0, offset_t align=1)
 
static SymbolDefinition CreateLocal (std::string name, Location location, offset_t size=0, offset_t align=1)
 
static SymbolDefinition CreateGlobal (std::string name, Location location, offset_t size=0, offset_t align=1)
 
static SymbolDefinition CreateWeak (std::string name, Location location, offset_t size=0, offset_t align=1)
 
static SymbolDefinition CreateCommon (std::string name, std::string section, offset_t size=0, offset_t align=1)
 
static SymbolDefinition CreateCommon (std::string name, std::string section, offset_t size, offset_t align, std::string alternative_section)
 
static SymbolDefinition CreateCommon (std::string name, std::string section, std::string alternative_section)
 
static SymbolDefinition CreateLocalCommon (std::string name, std::string section, offset_t size=0, offset_t align=1)
 
static SymbolDefinition CreateLocalCommon (std::string name, std::string section, offset_t size, offset_t align, std::string alternative_section)
 
static SymbolDefinition CreateLocalCommon (std::string name, std::string section, std::string alternative_section)
 

Public Attributes

std::string name
 
binding_type binding = Undefined
 
Location location
 
offset_t size = 0
 
offset_t align = 1
 
std::string section_name
 
std::string alternative_section_name
 

Protected Member Functions

 SymbolDefinition (std::string name, binding_type binding, Location location, offset_t size, offset_t align, std::string section_name="", std::string alternative_section_name="")
 

Detailed Description

Represents a symbol definition.

Member Enumeration Documentation

◆ binding_type

Enumerator
Undefined 

An undefined variable that needs to appear in another module for the linking process to succeed.

Local 

A variable that is only visible in the current module.

Global 

A variable that is visible in all modules and must appear once.

Weak 

A variable that is visible in all modules, however takes lower precedence than a Global variable.

Common 

A currently unallocated variable that should be allocated in the final stages of the linking process.

LocalCommon 

A currently unallocated local variable that should be allocated in the final stages of the linking process.

Member Function Documentation

◆ Displace()

bool SymbolDefinition::Displace ( const Displacement & displacement)

Recalculates the location after a section has moved.

Note that only local, global and weak symbol definitions have a location

Parameters
displacementA map from sections to locations, specifying the new starting place of the section. This can also indicate when a section has been appended to another one, and the location will be updated to reference the new section.
Returns
True if location changed due to displacement.

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