diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-17 16:31:39 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-17 16:31:39 +0000 |
commit | e45c74037051370faa1987ae385105b21f7463f3 (patch) | |
tree | a517357d55d407d1615f095f1174445da521e81d /llvm/tools/llvm-objdump/llvm-objdump.cpp | |
parent | 69d2ad031b5d4244f0fe35493f82e0c51296dc32 (diff) | |
download | bcm5719-llvm-e45c74037051370faa1987ae385105b21f7463f3.tar.gz bcm5719-llvm-e45c74037051370faa1987ae385105b21f7463f3.zip |
Fix an off-by-one bug in the target independent llvm-objdump.
It would prevent the display of a single byte instruction before a label.
Patch by Steve King!
llvm-svn: 215837
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r-- | llvm/tools/llvm-objdump/llvm-objdump.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index ebcee3b7f63..d7c9df1d6e7 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -494,17 +494,12 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { std::vector<RelocationRef>::const_iterator rel_end = Rels.end(); // Disassemble symbol by symbol. for (unsigned si = 0, se = Symbols.size(); si != se; ++si) { + uint64_t Start = Symbols[si].first; - 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. + // The end is either the section end or the beginning of the next symbol. + uint64_t End = (si == se - 1) ? SectSize : Symbols[si + 1].first; + // If this symbol has the same address as the next symbol, then skip it. + if (Start == End) continue; outs() << '\n' << Symbols[si].second << ":\n"; |