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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199340 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rui Ueyama 2014-01-15 23:46:18 +00:00
parent a034c96443
commit d12cef8281

View File

@ -230,11 +230,13 @@ static void printCOFFSymbolAddress(llvm::raw_ostream &Out,
// Prints import tables. The import table is a table containing the list of // 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. // DLL name and symbol names which will be linked by the loader.
static void printImportTables(const COFFObjectFile *Obj) { 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"; outs() << "The Import Tables:\n";
error_code ec; error_code ec;
for (import_directory_iterator i = Obj->import_directory_begin(), for (; i != e; i = i.increment(ec)) {
e = Obj->import_directory_end();
i != e; i = i.increment(ec)) {
if (ec) if (ec)
return; return;