[llvm] r208735 - [RuntimeDyld] Fix handling of i386 PC-rel external relocations. This fixes
Lang Hames
lhames at gmail.com
Tue May 13 15:09:07 PDT 2014
Author: lhames
Date: Tue May 13 17:09:07 2014
New Revision: 208735
URL: http://llvm.org/viewvc/llvm-project?rev=208735&view=rev
Log:
[RuntimeDyld] Fix handling of i386 PC-rel external relocations. This fixes
several more i386 MCJIT regression test failures.
<rdar://problem/16889891>
Modified:
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp?rev=208735&r1=208734&r2=208735&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp Tue May 13 17:09:07 2014
@@ -546,6 +546,17 @@ relocation_iterator RuntimeDyldMachO::pr
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;
More information about the llvm-commits
mailing list