From 5c2736b6c2905d71b90fe6595bb6f8e72096640e Mon Sep 17 00:00:00 2001 From: David Spickett Date: Mon, 30 Nov 2020 10:39:07 +0000 Subject: [PATCH] [llvm-objdump] Document --mattr=help in --help output This does the same as `--mcpu=help` but was only documented in the user guide. * Added a test for both options. * Corrected the single dash in `-mcpu=help` text. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D92305 --- docs/CommandGuide/llvm-objdump.rst | 2 +- test/tools/llvm-objdump/mattr-mcpu-help.test | 15 +++++++++++++++ tools/llvm-objdump/llvm-objdump.cpp | 10 +++++----- 3 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 test/tools/llvm-objdump/mattr-mcpu-help.test diff --git a/docs/CommandGuide/llvm-objdump.rst b/docs/CommandGuide/llvm-objdump.rst index 4acb04833ab..1ac7a05cbdb 100644 --- a/docs/CommandGuide/llvm-objdump.rst +++ b/docs/CommandGuide/llvm-objdump.rst @@ -156,7 +156,7 @@ OPTIONS .. option:: --mattr= - Enable/disable target-specific attributes. Specify ``--mcpu=help`` to display + Enable/disable target-specific attributes. Specify ``--mattr=help`` to display the available attributes. .. option:: --no-leading-addr diff --git a/test/tools/llvm-objdump/mattr-mcpu-help.test b/test/tools/llvm-objdump/mattr-mcpu-help.test new file mode 100644 index 00000000000..4c3198b0fbf --- /dev/null +++ b/test/tools/llvm-objdump/mattr-mcpu-help.test @@ -0,0 +1,15 @@ +# RUN: yaml2obj %s -o %t +# RUN: llvm-objdump -d %t --mattr=help 2>&1 | FileCheck %s +# RUN: llvm-objdump -d %t --mcpu=help 2>&1 | FileCheck %s + +# CHECK: Available CPUs for this target: +# CHECK: Available features for this target: +## To check we still disassemble the file: +# CHECK: file format elf64-x86-64 + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index bc13b26b797..bb33d254370 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -226,13 +226,13 @@ static cl::alias MachOm("m", cl::desc("Alias for --macho"), cl::NotHidden, cl::Grouping, cl::aliasopt(MachOOpt)); cl::opt objdump::MCPU( - "mcpu", cl::desc("Target a specific cpu type (-mcpu=help for details)"), + "mcpu", cl::desc("Target a specific cpu type (--mcpu=help for details)"), cl::value_desc("cpu-name"), cl::init(""), cl::cat(ObjdumpCat)); -cl::list objdump::MAttrs("mattr", cl::CommaSeparated, - cl::desc("Target specific attributes"), - cl::value_desc("a1,+a2,-a3,..."), - cl::cat(ObjdumpCat)); +cl::list objdump::MAttrs( + "mattr", cl::CommaSeparated, + cl::desc("Target specific attributes (--mattr=help for details)"), + cl::value_desc("a1,+a2,-a3,..."), cl::cat(ObjdumpCat)); cl::opt objdump::NoShowRawInsn( "no-show-raw-insn",