[RuntimeDyld] Fix handling of i386 PC-rel external relocations. This fixes

several more i386 MCJIT regression test failures.

<rdar://problem/16889891>



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208735 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Lang Hames 2014-05-13 22:09:07 +00:00
parent 8a8de72063
commit 9c29061391

View File

@ -546,6 +546,17 @@ relocation_iterator RuntimeDyldMachO::processRelocationRef(
Value.Addend = Addend;
}
}
// Addends for external, PC-rel relocations on i386 point back to the zero
// offset. Calculate the final offset from the relocation target instead.
// This allows us to use the same logic for both external and internal
// relocations in resolveI386RelocationRef.
if (Arch == Triple::x86 && IsPCRel) {
uint64_t RelocAddr = 0;
RelI->getAddress(RelocAddr);
Value.Addend += RelocAddr + 4;
}
} else {
SectionRef Sec = MachO->getRelocationSection(RE);
bool IsCode = false;