diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-11-11 09:58:25 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-11-11 09:58:25 +0000 |
commit | 185b5b1d24e1f3b61a2b964cbd7438d376466514 (patch) | |
tree | b0ea865963d9c95d3bc3e865fcffaa28701361d1 /llvm/tools/llvm-objdump/llvm-objdump.cpp | |
parent | bfd0039e731e539a867386e53919124ead43ed7f (diff) | |
download | bcm5719-llvm-185b5b1d24e1f3b61a2b964cbd7438d376466514.tar.gz bcm5719-llvm-185b5b1d24e1f3b61a2b964cbd7438d376466514.zip |
llvm-objdump: Skip empty sections when dumping contents
Empty sections are just noise when using objdump.
This is similar to what binutils does.
llvm-svn: 221680
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r-- | llvm/tools/llvm-objdump/llvm-objdump.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 2d1c86c618c..c61a5b2a67b 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -313,6 +313,8 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { uint64_t SectionAddr = Section.getAddress(); uint64_t SectSize = Section.getSize(); + if (!SectSize) + continue; // Make a list of all the symbols in this section. std::vector<std::pair<uint64_t, StringRef>> Symbols; @@ -514,11 +516,12 @@ static void PrintSectionContents(const ObjectFile *Obj) { if (error(Section.getName(Name))) continue; uint64_t BaseAddr = Section.getAddress(); - bool BSS = Section.isBSS(); + uint64_t Size = Section.getSize(); + if (!Size) + continue; outs() << "Contents of section " << Name << ":\n"; - if (BSS) { - uint64_t Size = Section.getSize(); + if (Section.isBSS()) { outs() << format("<skipping contents of bss section at [%04" PRIx64 ", %04" PRIx64 ")>\n", BaseAddr, BaseAddr + Size); |