summaryrefslogtreecommitdiff
path: root/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
commit9c290613915b866cda3128f8d400cf0141185159 (patch)
tree9be1a9ef5d58cc0aa2e3dc8d5fcbaab21d0fde9f /lib/ExecutionEngine
parent8a8de72063f2f78b3112881725e430c4c2994ce6 (diff)
downloadllvm-9c290613915b866cda3128f8d400cf0141185159.tar.gz
llvm-9c290613915b866cda3128f8d400cf0141185159.tar.bz2
llvm-9c290613915b866cda3128f8d400cf0141185159.tar.xz
[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
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
index df7f04cdf8..66456a990b 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
+++ b/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;