From b48e41be96251d39d8894f571f803d8d4831b952 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 20 Apr 2019 07:48:41 +0000 Subject: [PATCH] [llvm-objdump] Fix End in disassemblyObject after rL358806 llvm-svn: 358809 --- llvm/tools/llvm-objdump/llvm-objdump.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 37b17cb2f4a8..69a97853d2b2 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -1153,9 +1153,9 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj, // The end is the section end, the beginning of the next symbol, or // --stop-address. - uint64_t End = std::min( - SI + 1 < SE ? std::get<0>(Symbols[SI + 1]) : SectionAddr + SectSize, - StopAddress); + uint64_t End = std::min(SectionAddr + SectSize, StopAddress); + if (SI + 1 < SE) + End = std::min(End, std::get<0>(Symbols[SI + 1])); if (Start >= End || End <= StartAddress) continue; Start -= SectionAddr;