summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2011-10-13 20:37:08 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2011-10-13 20:37:08 +0000
commitee84f64f0bb86537ab5ff6398379264790453837 (patch)
tree2bed844cfd05bd9a2fd4a95936503f3ce8fb67aa /llvm/tools/llvm-objdump/llvm-objdump.cpp
parent9a28851e52c17541256a672b619af07af07a6bc6 (diff)
downloadbcm5719-llvm-ee84f64f0bb86537ab5ff6398379264790453837.tar.gz
bcm5719-llvm-ee84f64f0bb86537ab5ff6398379264790453837.zip
llvm-objdump: Fix dumping of multiple symbols with the same address.
This happens in COFF because there is a symbol for the beginning of each section. llvm-svn: 141885
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 66669cfe5d7..45642f955fa 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -234,7 +234,18 @@ static void DisassembleObject(const ObjectFile *Obj) {
// Disassemble symbol by symbol.
for (unsigned si = 0, se = Symbols.size(); si != se; ++si) {
uint64_t Start = Symbols[si].first;
- uint64_t End = si == se-1 ? SectSize : Symbols[si + 1].first - 1;
+ uint64_t End;
+ // The end is either the size of the section or the beginning of the next
+ // symbol.
+ if (si == se - 1)
+ End = SectSize;
+ // Make sure this symbol takes up space.
+ else if (Symbols[si + 1].first != Start)
+ End = Symbols[si + 1].first - 1;
+ else
+ // This symbol has the same address as the next symbol. Skip it.
+ continue;
+
outs() << '\n' << Symbols[si].second << ":\n";
#ifndef NDEBUG
OpenPOWER on IntegriCloud