[llvm] r220347 - [MCJIT] Defer application of AArch64 MachO GOT relocations until resolve time.
Lang Hames
lhames at gmail.com
Tue Oct 21 16:41:15 PDT 2014
Author: lhames
Date: Tue Oct 21 18:41:15 2014
New Revision: 220347
URL: http://llvm.org/viewvc/llvm-project?rev=220347&view=rev
Log:
[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 <rdar://problem/18693976>.
Modified:
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h?rev=220347&r1=220346&r2=220347&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h Tue Oct 21 18:41:15 2014
@@ -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<uintptr_t>(Section.Address) + i->second;
+ Offset = static_cast<int64_t>(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<int64_t>(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<uint64_t>(Addr));
+ addRelocationForSection(TargetRE, RE.SectionID);
}
};
}
Modified: llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s?rev=220347&r1=220346&r2=220347&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s (original)
+++ llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s Tue Oct 21 18:41:15 2014
@@ -1,5 +1,5 @@
# RUN: llvm-mc -triple=arm64-apple-ios7.0.0 -code-model=small -relocation-model=pic -filetype=obj -o %T/foo.o %s
-# RUN: llvm-rtdyld -triple=arm64-apple-ios7.0.0 -verify -check=%s %/T/foo.o
+# RUN: llvm-rtdyld -triple=arm64-apple-ios7.0.0 -map-section foo.o,__text=0x10bc0 -verify -check=%s %/T/foo.o
.section __TEXT,__text,regular,pure_instructions
.ios_version_min 7, 0
More information about the llvm-commits
mailing list