diff --git a/llvm/test/tools/llvm-objdump/X86/start-stop-address.test b/llvm/test/tools/llvm-objdump/X86/start-stop-address.test --- a/llvm/test/tools/llvm-objdump/X86/start-stop-address.test +++ b/llvm/test/tools/llvm-objdump/X86/start-stop-address.test @@ -67,6 +67,6 @@ // OUT-OF-RANGE-NOT: Disassembly -// RUN: not llvm-objdump -d %t.out --start-address=0x40 --stop-address=0x3f 2>&1 | FileCheck %s --check-prefix ERRMSG -// RUN: not llvm-objdump -d %t.out --start-address=0x40 --stop-address=0x40 2>&1 | FileCheck %s --check-prefix ERRMSG +// RUN: not llvm-objdump %t.out --start-address=0x40 --stop-address=0x3f 2>&1 | FileCheck %s --check-prefix ERRMSG +// RUN: not llvm-objdump %t.out --start-address=0x40 --stop-address=0x40 2>&1 | FileCheck %s --check-prefix ERRMSG // ERRMSG: start address should be less than stop address. diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -1453,9 +1453,6 @@ } static void disassembleObject(const ObjectFile *Obj, bool InlineRelocs) { - if (StartAddress >= StopAddress) - error("start address should be less than stop address"); - const Target *TheTarget = getTarget(Obj); // Package up features to be passed to target/subtarget @@ -2116,6 +2113,9 @@ cl::ParseCommandLineOptions(argc, argv, "llvm object file dumper\n"); + if (StartAddress >= StopAddress) + error("start address should be less than stop address"); + ToolName = argv[0]; // Defaults to a.out if no filenames specified.