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::Target Class Reference

Represents a possible target or reference frame of a relocation. More...

#include <target.h>

Public Member Functions

 Target (std::variant< Location, SymbolName > target=Location(), bool segment_of=false)
 
 Target (Location location, bool segment_of=false)
 
 Target (SymbolName symbol, bool segment_of=false)
 
Target GetSegment ()
 Creates a new target that references the segment of this target.
 
bool Displace (const Displacement &displacement)
 Recalculates target after a section has moved.
 
bool ResolveLocals (Module &object)
 If the target refers to an internal symbol, it gets resolved to a location.
 
bool Lookup (Module &object, Position &position)
 Returns a Position object for locations and internal symbols, if possible.
 

Public Attributes

std::variant< Location, SymbolNametarget
 The actual target, either an internal/absolute location, or an imported symbol.
 
bool segment_of
 Whether the target is the segment, rather than the offset, of the location or symbol.
 

Detailed Description

Represents a possible target or reference frame of a relocation.

When resolving a symbol as part of calculating a relocation, there are many possible outcomes. A symbol might reference an internal location, or an imported symbol. For segmented platforms, it might also reference the segment of a symbol, instead of an offset.

This class provides a representation for this structure.

Member Function Documentation

◆ Displace()

bool Target::Displace ( const Displacement & displacement)

Recalculates target after a section has moved.

If the target references a location, this function displaces it. It does nothing for imported symbols.

◆ GetSegment()

Target Target::GetSegment ( )

Creates a new target that references the segment of this target.

For segment targets, it returns an identical Target object.

◆ Lookup()

bool Target::Lookup ( Module & object,
Position & position )

Returns a Position object for locations and internal symbols, if possible.

Parameters
objectThe Module object where the symbols are looked up
positionThe returned Position object
Returns
True if lookup succeeded. Targets with undefined symbols return false.

◆ ResolveLocals()

bool Target::ResolveLocals ( Module & object)

If the target refers to an internal symbol, it gets resolved to a location.

Returns
True if target changed, when an internal symbol got resolved.

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