summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump
diff options
context:
space:
mode:
authorMichael Pozulp <pozulp.llvm@gmail.com>2019-06-07 05:11:13 +0000
committerMichael Pozulp <pozulp.llvm@gmail.com>2019-06-07 05:11:13 +0000
commit50f61af3f304a03f10d9ecb0828829f0a72d0099 (patch)
tree459686cf1e4d9fe03c1d1d8c1dcdb392640a727f /llvm/tools/llvm-objdump
parentc841b9abf039ec0457752cd96f7e4716c1c7a323 (diff)
downloadbcm5719-llvm-50f61af3f304a03f10d9ecb0828829f0a72d0099.tar.gz
bcm5719-llvm-50f61af3f304a03f10d9ecb0828829f0a72d0099.zip
[llvm-objdump] Add warning if --disassemble-functions specifies an unknown symbol
Summary: Fixes Bug 41904 https://bugs.llvm.org/show_bug.cgi?id=41904 Reviewers: jhenderson, rupprecht, grimar, MaskRay Reviewed By: jhenderson, rupprecht, MaskRay Subscribers: dexonsmith, rupprecht, kristina, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62275 llvm-svn: 362768
Diffstat (limited to 'llvm/tools/llvm-objdump')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 4e734a95de3..c384ba82feb 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -18,6 +18,7 @@
#include "llvm-objdump.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/Triple.h"
@@ -375,6 +376,10 @@ void warn(StringRef Message) {
errs().flush();
}
+void warn(Twine Message) {
+ WithColor::warning(errs(), ToolName) << Message << "\n";
+}
+
LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, Twine Message) {
WithColor::error(errs(), ToolName)
<< "'" << File << "': " << Message << ".\n";
@@ -1090,6 +1095,7 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj,
// Sort all the symbols, this allows us to use a simple binary search to find
// a symbol near an address.
+ StringSet<> FoundDisasmFuncsSet;
for (std::pair<const SectionRef, SectionSymbolsTy> &SecSyms : AllSymbols)
array_pod_sort(SecSyms.second.begin(), SecSyms.second.end());
array_pod_sort(AbsoluteSymbols.begin(), AbsoluteSymbols.end());
@@ -1181,6 +1187,8 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj,
uint64_t Start = std::get<0>(Symbols[SI]);
if (Start < SectionAddr || StopAddress <= Start)
continue;
+ else
+ FoundDisasmFuncsSet.insert(std::get<1>(Symbols[SI]));
// The end is the section end, the beginning of the next symbol, or
// --stop-address.
@@ -1401,6 +1409,10 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj,
}
}
}
+ StringSet<> MissingDisasmFuncsSet =
+ set_difference(DisasmFuncsSet, FoundDisasmFuncsSet);
+ for (StringRef MissingDisasmFunc : MissingDisasmFuncsSet.keys())
+ warn("failed to disassemble missing function " + MissingDisasmFunc);
}
static void disassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
OpenPOWER on IntegriCloud