]> granicus.if.org Git - llvm/commitdiff
[llvm-objdump] Fix End in disassemblyObject after rL358806
authorFangrui Song <maskray@google.com>
Sat, 20 Apr 2019 07:48:41 +0000 (07:48 +0000)
committerFangrui Song <maskray@google.com>
Sat, 20 Apr 2019 07:48:41 +0000 (07:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358809 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-objdump/llvm-objdump.cpp

index 37b17cb2f4a84cdb68904d50cc47f350a1f01acc..69a97853d2b2235ef2894bba3ef9b35ddda7070f 100644 (file)
@@ -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<uint64_t>(
-          SI + 1 < SE ? std::get<0>(Symbols[SI + 1]) : SectionAddr + SectSize,
-          StopAddress);
+      uint64_t End = std::min<uint64_t>(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;