diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-10-13 20:37:08 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-10-13 20:37:08 +0000 |
commit | 178dbd44187e23e7e3f3ba17b00c89c819070296 (patch) | |
tree | 9a4bfd28495ad6dd5f1b9ab6e0374f5c360ad83d /tools | |
parent | bff6f8679a3e4006653157ca11cee9dc58c68f8b (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141885 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-objdump/llvm-objdump.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index 66669cfe5d..45642f955f 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/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 |