Fix an assertion caused by using inline asm with indirect register inputs.
[oota-llvm.git] / lib / ExecutionEngine / RuntimeDyld / RuntimeDyldELF.cpp
index 0a593e60f2dad0a4f06b15cbb93b26a36291c010..96b4e127aa6373e58d4ea753aece604b8a4f39dd 100644 (file)
@@ -1206,11 +1206,11 @@ void RuntimeDyldELF::processRelocationRef(unsigned SectionID,
           resolveRelocation(Section, Offset,
                             (uint64_t)Section.Address + Section.StubOffset,
                             RelType, 0);
-          if (SymType == SymbolRef::ST_Unknown)
-            // Restore the TOC for external calls
-            writeInt32BE(Target+4, 0xE8410028); // ld r2,40(r1)
           Section.StubOffset += getMaxStubSize();
         }
+        if (SymType == SymbolRef::ST_Unknown)
+          // Restore the TOC for external calls
+          writeInt32BE(Target+4, 0xE8410028); // ld r2,40(r1)
       }
     } else {
       RelocationEntry RE(SectionID, Offset, RelType, Value.Addend);