[PATCH] D92217: [llvm-objdump] Remove -mcpu=help from help text

David Spickett via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 27 03:34:04 PST 2020


DavidSpickett added a comment.

I figured it needed a file at least to know which target it should list cpus for, but now I see what I was doing wrong:

  $ ./bin/llvm-objdump --mcpu=help /tmp/arm64.o -d
  
  /tmp/arm64.o:   file format elf64-littleaarch64
  
  Available CPUs for this target:
  
    a64fx         - Select the a64fx processor.
  <...>
  
  Disassembly of section .init:

The cpus are printed to stderr and I just piped it into less to see the first bit easily so all I saw was the disassembly.

  $ ./bin/llvm-objdump --mcpu=help /tmp/arm64.o -d 2>/dev/null
  
  /tmp/arm64.o:   file format elf64-littleaarch64
  
  
  Disassembly of section .init:

I see that --mattr=help also works this way. I assume that's because if you pass an invalid name it also prints to stderr,
but it's not an error, so you would still disassemble:

  $ ./bin/llvm-objdump --mcpu=abcdef /tmp/arm64.o -d 1>/dev/null
  'abcdef' is not a recognized processor for this target (ignoring processor)
  'abcdef' is not a recognized processor for this target (ignoring processor)
  $ $?
  -bash: 0: command not found

(why it prints twice is another matter, --mattr doesn't)

Seems to me that:

- --mattr=help should be documented too
- The "--mcpu/attr=help" output should be on stdout (which is probably more tricky than I think it is)
- llvm-objdump shouldn't disassemble the file if you use those options (like `llvm-objdump -d foo.o --help` doesn't)

Which is probably easier said than done but does the logic make sense to you? At least I can do the first one point quickly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92217/new/

https://reviews.llvm.org/D92217



More information about the llvm-commits mailing list