summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h')
-rw-r--r--contrib/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/contrib/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h b/contrib/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
index 7bf7641..dbca377 100644
--- a/contrib/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
+++ b/contrib/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
@@ -34,7 +34,7 @@ public:
/// Extract the addend encoded in the instruction / memory location.
int64_t decodeAddend(const RelocationEntry &RE) const {
const SectionEntry &Section = Sections[RE.SectionID];
- uint8_t *LocalAddress = Section.Address + RE.Offset;
+ uint8_t *LocalAddress = Section.getAddressWithOffset(RE.Offset);
unsigned NumBytes = 1 << RE.Size;
int64_t Addend = 0;
// Verify that the relocation has the correct size and alignment.
@@ -272,15 +272,14 @@ public:
RelocationEntry RE(getRelocationEntry(SectionID, Obj, RelI));
RE.Addend = decodeAddend(RE);
- RelocationValueRef Value(
- getRelocationValueRef(Obj, RelI, RE, ObjSectionToID));
assert((ExplicitAddend == 0 || RE.Addend == 0) && "Relocation has "\
"ARM64_RELOC_ADDEND and embedded addend in the instruction.");
- if (ExplicitAddend) {
+ if (ExplicitAddend)
RE.Addend = ExplicitAddend;
- Value.Offset = ExplicitAddend;
- }
+
+ RelocationValueRef Value(
+ getRelocationValueRef(Obj, RelI, RE, ObjSectionToID));
bool IsExtern = Obj.getPlainRelocationExternal(RelInfo);
if (!IsExtern && RE.IsPCRel)
@@ -305,7 +304,7 @@ public:
DEBUG(dumpRelocationToResolve(RE, Value));
const SectionEntry &Section = Sections[RE.SectionID];
- uint8_t *LocalAddress = Section.Address + RE.Offset;
+ uint8_t *LocalAddress = Section.getAddressWithOffset(RE.Offset);
MachO::RelocationInfoType RelType =
static_cast<MachO::RelocationInfoType>(RE.RelType);
@@ -325,7 +324,7 @@ public:
case MachO::ARM64_RELOC_BRANCH26: {
assert(RE.IsPCRel && "not PCRel and ARM64_RELOC_BRANCH26 not supported");
// Check if branch is in range.
- uint64_t FinalAddress = Section.LoadAddress + RE.Offset;
+ uint64_t FinalAddress = Section.getLoadAddressWithOffset(RE.Offset);
int64_t PCRelVal = Value - FinalAddress + RE.Addend;
encodeAddend(LocalAddress, /*Size=*/4, RelType, PCRelVal);
break;
@@ -334,7 +333,7 @@ public:
case MachO::ARM64_RELOC_PAGE21: {
assert(RE.IsPCRel && "not PCRel and ARM64_RELOC_PAGE21 not supported");
// Adjust for PC-relative relocation and offset.
- uint64_t FinalAddress = Section.LoadAddress + RE.Offset;
+ uint64_t FinalAddress = Section.getLoadAddressWithOffset(RE.Offset);
int64_t PCRelVal =
((Value + RE.Addend) & (-4096)) - (FinalAddress & (-4096));
encodeAddend(LocalAddress, /*Size=*/4, RelType, PCRelVal);
@@ -376,10 +375,10 @@ private:
else {
// FIXME: There must be a better way to do this then to check and fix the
// alignment every time!!!
- uintptr_t BaseAddress = uintptr_t(Section.Address);
+ uintptr_t BaseAddress = uintptr_t(Section.getAddress());
uintptr_t StubAlignment = getStubAlignment();
uintptr_t StubAddress =
- (BaseAddress + Section.StubOffset + StubAlignment - 1) &
+ (BaseAddress + Section.getStubOffset() + StubAlignment - 1) &
-StubAlignment;
unsigned StubOffset = StubAddress - BaseAddress;
Stubs[Value] = StubOffset;
@@ -392,7 +391,7 @@ private:
addRelocationForSymbol(GOTRE, Value.SymbolName);
else
addRelocationForSection(GOTRE, Value.SectionID);
- Section.StubOffset = StubOffset + getMaxStubSize();
+ Section.advanceStubOffset(getMaxStubSize());
Offset = static_cast<int64_t>(StubOffset);
}
RelocationEntry TargetRE(RE.SectionID, RE.Offset, RE.RelType, Offset,
OpenPOWER on IntegriCloud