Skip to content

Commit 942cb7b

Browse files
committed
[MCJIT] Fix a case of Error::success() being passed to report_fatal_error.
MCJIT::getSymbolAddress was handling a non-fatal error condition of JITSymbol as fatal. JITSymbol::operator bool returns false if no address is available but no error is set. This can occur e.g. if the symbol name was not found. Patch by Jascha Wetzel. Thanks Jascha! llvm-svn: 339809
1 parent 6a691a0 commit 942cb7b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,9 @@ uint64_t MCJIT::getSymbolAddress(const std::string &Name,
326326
return *AddrOrErr;
327327
else
328328
report_fatal_error(AddrOrErr.takeError());
329-
} else
329+
} else if (auto Err = Sym.takeError())
330330
report_fatal_error(Sym.takeError());
331+
return 0;
331332
}
332333

333334
JITSymbol MCJIT::findSymbol(const std::string &Name,

0 commit comments

Comments
 (0)