diff options
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp index fa8906869b3..79a1bbb1a77 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp @@ -16,6 +16,7 @@ #include "llvm/MC/MCInst.h" #include "llvm/Support/Path.h" #include <cctype> +#include <future> #include <memory> #include <utility> @@ -729,15 +730,29 @@ bool RuntimeDyldCheckerImpl::checkAllRulesInBuffer(StringRef RulePrefix, return DidAllTestsPass && (NumRules != 0); } +Expected<JITSymbolResolver::LookupResult> RuntimeDyldCheckerImpl::lookup( + const JITSymbolResolver::LookupSet &Symbols) const { + auto ResultP = std::make_shared< + std::promise<Expected<JITSymbolResolver::LookupResult>>>(); + auto ResultF = ResultP->get_future(); + + getRTDyld().Resolver.lookup( + Symbols, [=](Expected<JITSymbolResolver::LookupResult> Result) { + ResultP->set_value(std::move(Result)); + }); + return ResultF.get(); +} + bool RuntimeDyldCheckerImpl::isSymbolValid(StringRef Symbol) const { if (getRTDyld().getSymbol(Symbol)) return true; - JITSymbolResolver::LookupSet Symbols({Symbol}); - auto Result = getRTDyld().Resolver.lookup(Symbols); + auto Result = lookup({Symbol}); + if (!Result) { logAllUnhandledErrors(Result.takeError(), errs(), "RTDyldChecker: "); return false; } + assert(Result->count(Symbol) && "Missing symbol result"); return true; } @@ -751,8 +766,7 @@ uint64_t RuntimeDyldCheckerImpl::getSymbolRemoteAddr(StringRef Symbol) const { if (auto InternalSymbol = getRTDyld().getSymbol(Symbol)) return InternalSymbol.getAddress(); - JITSymbolResolver::LookupSet Symbols({Symbol}); - auto Result = getRTDyld().Resolver.lookup(Symbols); + auto Result = lookup({Symbol}); if (!Result) { logAllUnhandledErrors(Result.takeError(), errs(), "RTDyldChecker: "); return 0; |