168 bool Displace(
const Displacement& displacement);
208 std::ostream& operator<<(std::ostream& out,
const Relocation& relocation);
Represents a single offset within a section, or an absolute location in memory if the section is null...
Definition location.h:17
Encodes an object module file as a collection of sections, symbols and relocations.
Definition module.h:20
A representation of a value within some binary data that has to be fixed up once the exact position o...
Definition relocation.h:27
static Relocation Paragraph(Location source, Target target, uint64_t addend=0)
Creates a relocation that stores the 16-bit paragraph (shifted right by 4) of the target (Intel 8086 ...
Definition relocation.cc:53
Relocation & SetShift(int new_shift)
The value stored in the word must be shifted by this to give the actual value.
Definition relocation.cc:83
Location source
The location where the value of the symbol should be stored.
Definition relocation.h:43
bool Resolve(Module &object, Resolution &resolution)
If the target and reference symbols can be resolved, return the value with some additional informatio...
Definition relocation.cc:100
bool segment_of
Set when the value to be stored is the segment selector instead of the segment start (Intel 8086 spec...
Definition relocation.h:35
static Relocation Offset(size_t size, Location source, Target target, uint64_t addend, EndianType endiantype)
Creates a relocation that references the offset of a target within its preferred segment (Intel 8086 ...
Definition relocation.cc:21
static Relocation Relative(size_t size, Location source, Target target, uint64_t addend, EndianType endiantype)
Creates a relocation that references the offset of a target from the source.
Definition relocation.cc:43
void AddCurrentValue()
Updates the addend with the value stored in the section data.
Definition relocation.cc:164
Relocation & SetSubtract(bool to_subtract=true)
The value stored in the word must be negated before adding the addend and storing.
Definition relocation.cc:89
EndianType endiantype
The endianness of the stored value.
Definition relocation.h:59
int64_t ReadSigned()
Accesses the value within the section data.
Definition relocation.cc:139
Target target
The symbol or location referenced by the relocation.
Definition relocation.h:47
static Relocation ParagraphDifference(Location source, Target target, Target reference, uint64_t addend=0)
Creates a relocation that stores the 16-bit paragraph difference (shifted right by 4) between the tar...
Definition relocation.cc:71
static Relocation Absolute(size_t size, Location source, Target target, uint64_t addend, EndianType endiantype)
Creates a relocation referencing the absolute address of a target.
Definition relocation.cc:11
Relocation & SetMask(uint64_t new_mask)
Instead of the full word, only modify the following bits.
Definition relocation.cc:77
uint64_t addend
A value to be added.
Definition relocation.h:55
Target reference
The symbol or location whose value is subtracted from the final value, used for self-relative and seg...
Definition relocation.h:51
static Relocation Selector(Location source, Target target, uint64_t addend=0)
Creates a relocation that stores the 16-bit paragraph (shifted right by 4) of the target (Intel 8086 ...
Definition relocation.cc:59
uint64_t mask
The bitmask of the value within the word.
Definition relocation.h:67
bool Displace(const Displacement &displacement)
Recalculates the source, target and reference locations after a section has moved.
Definition relocation.cc:95
void WriteWord(uint64_t value)
Accesses the value within the section data.
Definition relocation.cc:150
static Relocation OffsetFrom(size_t size, Location source, Target target, Target reference, uint64_t addend, EndianType endiantype)
Creates a relocation that references the offset of a target from a specific reference point.
Definition relocation.cc:33
bool subtract
Set to true if value must be negated first.
Definition relocation.h:71
static Relocation Empty()
Creates an empty relocation.
Definition relocation.cc:6
bool IsRelative() const
Determines if a relocation is self-relative.
Definition relocation.cc:170
static Relocation Segment(size_t size, Location source, Target target, uint64_t addend=0)
Creates a relocation that stores the 8-bit segment number of the target (Zilog Z8000 specific)
Definition relocation.cc:65
uint64_t ReadUnsigned()
Accesses the value within the section data.
Definition relocation.cc:128
size_t size
The size of the value when stored at the source, in bytes (for example, 2 for 16-bit,...
Definition relocation.h:39
int shift
The amount of bits the value should be shifted by.
Definition relocation.h:63
Representing a resolved relocation.
Definition resolution.h:17
Represents a possible target or reference frame of a relocation.
Definition target.h:24