From 1316365e2cee88687b503d3818987a5fed147463 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Wed, 30 Jul 2014 03:35:05 +0000 Subject: [MCJIT] Fix the ARM BR24 relocation in RuntimeDyldMachO. We now (1) correctly decode the branch immediate, (2) modify the immediate to corretly treat it as PC-rel, and (3) properly populate the stub entry. Previously we had been doing each of these wrong. llvm-svn: 214285 --- llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp') diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp index 920b999fa08..bae2471054d 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp @@ -79,7 +79,8 @@ RelocationValueRef RuntimeDyldMachO::getRelocationValueRef( void RuntimeDyldMachO::makeValueAddendPCRel(RelocationValueRef &Value, ObjectImage &ObjImg, - const relocation_iterator &RI) { + const relocation_iterator &RI, + unsigned OffsetToNextPC) { const MachOObjectFile &Obj = static_cast(*ObjImg.getObjectFile()); MachO::any_relocation_info RelInfo = @@ -89,8 +90,7 @@ void RuntimeDyldMachO::makeValueAddendPCRel(RelocationValueRef &Value, if (IsPCRel) { uint64_t RelocAddr = 0; RI->getAddress(RelocAddr); - unsigned RelocSize = Obj.getAnyRelocationLength(RelInfo); - Value.Addend += RelocAddr + (1ULL << RelocSize); + Value.Addend += RelocAddr + OffsetToNextPC; } } -- cgit v1.2.3