RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
|
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 |
Location & | operator+= (offset_t value) |
Location & | operator-= (offset_t value) |
Public Attributes | |
std::shared_ptr< Section > | section |
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. | |
Represents a single offset within a section, or an absolute location in memory if the section is null.
bool Location::Displace | ( | const Displacement & | displacement | ) |
Recalculates location after a section has moved.
displacement | A 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. |
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.