[MCJIT] Improve the "stub not found" diagnostic in RuntimeDyldChecker.
authorLang Hames <lhames@gmail.com>
Thu, 11 Sep 2014 23:09:22 +0000 (23:09 +0000)
committerLang Hames <lhames@gmail.com>
Thu, 11 Sep 2014 23:09:22 +0000 (23:09 +0000)
A "stub found found" diagnostic is emitted when RuntimeDyldChecker's stub lookup
logic fails to find the requested stub. The obvious reason for the failure is
that no such stub has been created, but it can also fail for internal symbols if
the symbol offset is not computed correctly (E.g. due to a mangled relocation
addend). This patch adds a comment about the latter case so that it's not
overlooked.

Inspired by confusion experienced during test case construction for r217635.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217643 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp

index 49234f59b0bac8be1ac6f2aab2bff9e8c3c839d5..dad02dca531a88182d55a7b66f6e0ab91cd91aac 100644 (file)
@@ -825,7 +825,10 @@ std::pair<uint64_t, std::string> RuntimeDyldCheckerImpl::getStubAddrFor(
   auto StubOffsetItr = SymbolStubs.find(SymbolName);
   if (StubOffsetItr == SymbolStubs.end())
     return std::make_pair(0,
-                          ("Symbol '" + SymbolName + "' not found.\n").str());
+                          ("Stub for symbol '" + SymbolName + "' not found. "
+                           "If '" + SymbolName + "' is an internal symbol this "
+                           "may indicate that the stub target offset is being "
+                           "computed incorrectly.\n").str());
 
   uint64_t StubOffset = StubOffsetItr->second;