[MCJIT] Fix the ARM BR24 relocation in RuntimeDyldMachO.
[oota-llvm.git] / lib / ExecutionEngine / RuntimeDyld / RuntimeDyldMachO.cpp
index 920b999fa089cc26cdb6cecc1cbec6e268164f6a..bae2471054df548ede68341043b92260bc4c5127 100644 (file)
@@ -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<const MachOObjectFile &>(*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;
   }
 }