From 41d95947cfc4b143cd0ca922e93cc582a6d10e96 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 21 Oct 2014 23:41:15 +0000 Subject: [MCJIT] Defer application of AArch64 MachO GOT relocations until resolve time. On AArch64, GOT references are page relative (ADRP + LDR), so they can't be applied until we know exactly where, within a page, the GOT entry will be in the target address space. Fixes . llvm-svn: 220347 --- .../RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'llvm/lib/ExecutionEngine') diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h b/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h index 980daaaf625..f5cf9ac29bf 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h @@ -368,9 +368,9 @@ private: assert(RE.Size == 2); SectionEntry &Section = Sections[RE.SectionID]; StubMap::const_iterator i = Stubs.find(Value); - uintptr_t Addr; + int64_t Offset; if (i != Stubs.end()) - Addr = reinterpret_cast(Section.Address) + i->second; + Offset = static_cast(i->second); else { // FIXME: There must be a better way to do this then to check and fix the // alignment every time!!! @@ -391,11 +391,11 @@ private: else addRelocationForSection(GOTRE, Value.SectionID); Section.StubOffset = StubOffset + getMaxStubSize(); - Addr = StubAddress; + Offset = static_cast(StubOffset); } - RelocationEntry TargetRE(RE.SectionID, RE.Offset, RE.RelType, /*Addend=*/0, + RelocationEntry TargetRE(RE.SectionID, RE.Offset, RE.RelType, Offset, RE.IsPCRel, RE.Size); - resolveRelocation(TargetRE, static_cast(Addr)); + addRelocationForSection(TargetRE, RE.SectionID); } }; } -- cgit v1.2.3