summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-01-15 23:46:18 +0000
committerRui Ueyama <ruiu@google.com>2014-01-15 23:46:18 +0000
commit908dfcd8e4772b496675712ef068662c74be6a56 (patch)
tree2fbf1d2bce583e7213975497e0bd9ad1c59bb51d
parentc0f92a2dc9ea2f10480f35096e6af0fac897e0d1 (diff)
downloadbcm5719-llvm-908dfcd8e4772b496675712ef068662c74be6a56.tar.gz
bcm5719-llvm-908dfcd8e4772b496675712ef068662c74be6a56.zip
llvm-objdump: Don't print "Import table:" header if there's no import table.
If a binary does not depend on any DLL, it does not contain import table at all. Printing the section title without contents looks wrong, so we shouldn't print it in that case. llvm-svn: 199340
-rw-r--r--llvm/tools/llvm-objdump/COFFDump.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/tools/llvm-objdump/COFFDump.cpp b/llvm/tools/llvm-objdump/COFFDump.cpp
index 5f0bcbbc92d..9c380100e8c 100644
--- a/llvm/tools/llvm-objdump/COFFDump.cpp
+++ b/llvm/tools/llvm-objdump/COFFDump.cpp
@@ -230,11 +230,13 @@ static void printCOFFSymbolAddress(llvm::raw_ostream &Out,
// Prints import tables. The import table is a table containing the list of
// DLL name and symbol names which will be linked by the loader.
static void printImportTables(const COFFObjectFile *Obj) {
+ import_directory_iterator i = Obj->import_directory_begin();
+ import_directory_iterator e = Obj->import_directory_end();
+ if (i == e)
+ return;
outs() << "The Import Tables:\n";
error_code ec;
- for (import_directory_iterator i = Obj->import_directory_begin(),
- e = Obj->import_directory_end();
- i != e; i = i.increment(ec)) {
+ for (; i != e; i = i.increment(ec)) {
if (ec)
return;
OpenPOWER on IntegriCloud