[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>.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220347 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Lang Hames 2014-10-21 23:41:15 +00:00
parent f6b403a753
commit 8c4980b307
2 changed files with 6 additions and 6 deletions

View File

@ -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);
}
};
}

View File

@ -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