summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2014-05-13 22:09:07 +0000
committerLang Hames <lhames@gmail.com>2014-05-13 22:09:07 +0000
commit890758d5b38a6fc667a12d5fe7902ed155faf7b3 (patch)
treea6599b3f847131c26a1166ef0c64d8684fe2dbb9 /llvm/lib/ExecutionEngine
parent40ca913727f914b720b30d4e3ccc66250fb4aba2 (diff)
downloadbcm5719-llvm-890758d5b38a6fc667a12d5fe7902ed155faf7b3.tar.gz
bcm5719-llvm-890758d5b38a6fc667a12d5fe7902ed155faf7b3.zip
[RuntimeDyld] Fix handling of i386 PC-rel external relocations. This fixes
several more i386 MCJIT regression test failures. <rdar://problem/16889891> llvm-svn: 208735
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
index df7f04cdf8b..66456a990b7 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
@@ -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;
OpenPOWER on IntegriCloud