diff --git a/include/llvm/ExecutionEngine/RuntimeDyldChecker.h b/include/llvm/ExecutionEngine/RuntimeDyldChecker.h index 38a4ea1ad52..8dd891e8364 100644 --- a/include/llvm/ExecutionEngine/RuntimeDyldChecker.h +++ b/include/llvm/ExecutionEngine/RuntimeDyldChecker.h @@ -81,7 +81,7 @@ public: private: - bool checkSymbolIsValidForLoad(StringRef Symbol) const; + bool isSymbolValid(StringRef Symbol) const; uint64_t getSymbolAddress(StringRef Symbol) const; uint64_t readMemoryAtSymbol(StringRef Symbol, int64_t Offset, unsigned Size) const; diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp index 190bbbf93ff..b10ec360aa5 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp @@ -199,7 +199,7 @@ namespace llvm { StringRef Symbol; std::tie(Symbol, RemainingExpr) = parseSymbol(RemainingExpr); - if (!Checker.checkSymbolIsValidForLoad(Symbol)) + if (!Checker.isSymbolValid(Symbol)) return std::make_pair(EvalResult(("Cannot decode unknown symbol '" + Symbol + "'").str()), ""); @@ -268,7 +268,7 @@ namespace llvm { StringRef Symbol; std::tie(Symbol, RemainingExpr) = parseSymbol(RemainingExpr); - if (!Checker.checkSymbolIsValidForLoad(Symbol)) + if (!Checker.isSymbolValid(Symbol)) return std::make_pair(EvalResult(("Cannot decode unknown symbol '" + Symbol + "'").str()), ""); @@ -304,6 +304,17 @@ namespace llvm { else if (Symbol == "next_pc") return evalNextPC(RemainingExpr); + if (!Checker.isSymbolValid(Symbol)) { + std::string ErrMsg("No known address for symbol '"); + ErrMsg += Symbol; + ErrMsg += "'"; + if (Symbol.startswith("L")) + ErrMsg += " (this appears to be an assembler local label - " + " perhaps drop the 'L'?)"; + + return std::make_pair(EvalResult(ErrMsg), ""); + } + // Looks like a plain symbol reference. return std::make_pair(EvalResult(Checker.getSymbolAddress(Symbol)), RemainingExpr); @@ -397,7 +408,7 @@ namespace llvm { StringRef Symbol; std::tie(Symbol, RemainingExpr) = parseSymbol(RemainingExpr); - if (!Checker.checkSymbolIsValidForLoad(Symbol)) + if (!Checker.isSymbolValid(Symbol)) return std::make_pair(EvalResult(("Cannot dereference unknown symbol '" + Symbol + "'").str()), ""); @@ -612,7 +623,7 @@ bool RuntimeDyldChecker::checkAllRulesInBuffer(StringRef RulePrefix, return DidAllTestsPass && (NumRules != 0); } -bool RuntimeDyldChecker::checkSymbolIsValidForLoad(StringRef Symbol) const { +bool RuntimeDyldChecker::isSymbolValid(StringRef Symbol) const { return RTDyld.getSymbolAddress(Symbol) != nullptr; }