Skip to content

Commit c2ead57

Browse files
committed
[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
1 parent 13c42f4 commit c2ead57

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

llvm/docs/CommandGuide/llvm-objdump.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ OPTIONS
156156

157157
.. option:: --mattr=<a1,+a2,-a3,...>
158158

159-
Enable/disable target-specific attributes. Specify ``--mcpu=help`` to display
159+
Enable/disable target-specific attributes. Specify ``--mattr=help`` to display
160160
the available attributes.
161161

162162
.. option:: --no-leading-addr
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# RUN: yaml2obj %s -o %t
2+
# RUN: llvm-objdump -d %t --mattr=help 2>&1 | FileCheck %s
3+
# RUN: llvm-objdump -d %t --mcpu=help 2>&1 | FileCheck %s
4+
5+
# CHECK: Available CPUs for this target:
6+
# CHECK: Available features for this target:
7+
## To check we still disassemble the file:
8+
# CHECK: file format elf64-x86-64
9+
10+
--- !ELF
11+
FileHeader:
12+
Class: ELFCLASS64
13+
Data: ELFDATA2LSB
14+
Type: ET_EXEC
15+
Machine: EM_X86_64

llvm/tools/llvm-objdump/llvm-objdump.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,13 @@ static cl::alias MachOm("m", cl::desc("Alias for --macho"), cl::NotHidden,
226226
cl::Grouping, cl::aliasopt(MachOOpt));
227227

228228
cl::opt<std::string> objdump::MCPU(
229-
"mcpu", cl::desc("Target a specific cpu type (-mcpu=help for details)"),
229+
"mcpu", cl::desc("Target a specific cpu type (--mcpu=help for details)"),
230230
cl::value_desc("cpu-name"), cl::init(""), cl::cat(ObjdumpCat));
231231

232-
cl::list<std::string> objdump::MAttrs("mattr", cl::CommaSeparated,
233-
cl::desc("Target specific attributes"),
234-
cl::value_desc("a1,+a2,-a3,..."),
235-
cl::cat(ObjdumpCat));
232+
cl::list<std::string> objdump::MAttrs(
233+
"mattr", cl::CommaSeparated,
234+
cl::desc("Target specific attributes (--mattr=help for details)"),
235+
cl::value_desc("a1,+a2,-a3,..."), cl::cat(ObjdumpCat));
236236

237237
cl::opt<bool> objdump::NoShowRawInsn(
238238
"no-show-raw-insn",

0 commit comments

Comments
 (0)