[llvm] r334536 - [RuntimeDyld] Add an assert to catch misbehaving symbol resolvers.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 12 13:43:17 PDT 2018
Author: lhames
Date: Tue Jun 12 13:43:17 2018
New Revision: 334536
URL: http://llvm.org/viewvc/llvm-project?rev=334536&view=rev
Log:
[RuntimeDyld] Add an assert to catch misbehaving symbol resolvers.
Resolvers are required to find results for all requested symbols or return an
error, but if a resolver fails to adhere to this contract (by returning results
for only a subset of the requested symbols) then this code will infinite loop.
This assertion catches resolvers that fail to adhere to the contract.
Modified:
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=334536&r1=334535&r2=334536&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Tue Jun 12 13:43:17 2018
@@ -1017,6 +1017,9 @@ Error RuntimeDyldImpl::resolveExternalSy
if (!NewResolverResults)
return NewResolverResults.takeError();
+ assert(NewResolverResults->size() == NewSymbols.size() &&
+ "Should have errored on unresolved symbols");
+
for (auto &RRKV : *NewResolverResults) {
assert(!ResolvedSymbols.count(RRKV.first) && "Redundant resolution?");
ExternalSymbolMap.insert(RRKV);
More information about the llvm-commits
mailing list