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

Represents a single offset within a section, or an absolute location in memory if the section is null. More...

#include <location.h>

Public Member Functions

 Location (std::shared_ptr< Section > section, offset_t offset=0)
 Creates a location within a section.
 
 Location (offset_t offset=0)
 Creates an absolute location.
 
bool Displace (const Displacement &displacement)
 Recalculates location after a section has moved.
 
Position GetPosition (bool segment_of=false) const
 Calculates the address.
 
bool operator== (const Location &other) const
 
Locationoperator+= (offset_t value)
 
Locationoperator-= (offset_t value)
 

Public Attributes

std::shared_ptr< Sectionsection
 The section the symbol is located in, or null for an absolute location.
 
offset_t offset
 The offset of the symbol within a section, or the absolute address.
 

Detailed Description

Represents a single offset within a section, or an absolute location in memory if the section is null.

Member Function Documentation

◆ Displace()

bool Location::Displace ( const Displacement & displacement)

Recalculates location after a section has moved.

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.

◆ GetPosition()

Position Location::GetPosition ( bool segment_of = false) const

Calculates the address.

Using the starting addresses of sections, calculates the address of the location, as well as the segment it belongs to.

On some platforms, most prominently on the Intel 8086, addresses are composed of a preferred segment and an offset within that segment. Symbols will have an associated hardware segment, which is usually, but not always, mapped onto the linker's idea of a Segment.


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