Reapply r250906 with many suggested updates from Rafael Espindola.
[oota-llvm.git] / lib / ExecutionEngine / MCJIT / MCJIT.cpp
index bbe4432d36b318a1a40de7dbd4887d44a1ed58c4..6cbebe98e7c92fc801ce50b0b10a5ad08122fd96 100644 (file)
@@ -318,10 +318,12 @@ RuntimeDyld::SymbolInfo MCJIT::findSymbol(const std::string &Name,
     object::Archive *A = OB.getBinary();
     // Look for our symbols in each Archive
     object::Archive::child_iterator ChildIt = A->findSym(Name);
+    if (std::error_code EC = ChildIt->getError())
+      report_fatal_error(EC.message());
     if (ChildIt != A->child_end()) {
       // FIXME: Support nested archives?
       ErrorOr<std::unique_ptr<object::Binary>> ChildBinOrErr =
-          ChildIt->getAsBinary();
+          (*ChildIt)->getAsBinary();
       if (ChildBinOrErr.getError())
         continue;
       std::unique_ptr<object::Binary> &ChildBin = ChildBinOrErr.get();