This is an archive of the discontinued LLVM Phabricator instance.

[llvm-nm] Help option output should be consistent with the command guide
ClosedPublic

Authored by gbreynoo on May 7 2021, 7:32 AM.

Details

Summary

The nm command guide shows the short options used as aliases but these are not found in the help text unless --show-hidden is used, other tools show aliases with --help. This change fixes the help output to be consistent with the command guide.

Diff Detail

Event Timeline

gbreynoo created this revision.May 7 2021, 7:32 AM
gbreynoo requested review of this revision.May 7 2021, 7:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 7 2021, 7:32 AM
keith accepted this revision.May 7 2021, 1:52 PM

It's too bad this format doesn't look like python's where it shows it inline:

-q, --quiet           Suppress no error output

For reference for other reviewers here's the diff in -help with this change:

--- /tmp/before.log	2021-05-07 13:46:23.154086836 -0700
+++ /tmp/after.log	2021-05-07 13:47:01.999269513 -0700
@@ -12,8 +12,16 @@
 
 llvm-nm Options:
 
+  -A                 - Alias for --print-file-name
   -B                 - Alias for --format=bsd
+  -C                 - Alias for --demangle
+  -D                 - Alias for --dynamic
+  -M                 - Alias for --print-armap
   -P                 - Alias for --format=posix
+  -S                 - Alias for --print-size
+  -U                 - Alias for --defined-only
+  -W                 - Alias for --no-weak
+  -a                 - Alias for --debug-syms
   --add-dyldinfo     - Add symbols from the dyldinfo not already in the symbol table, Mach-O only
   --add-inlinedinfo  - Add symbols from the inlined libraries, TBD(Mach-O) only
   --arch=<string>    - architecture(s) from a Mach-O file to dump
@@ -23,25 +31,32 @@
   --dyldinfo-only    - Show only symbols from the dyldinfo, Mach-O only
   --dynamic          - Display the dynamic symbols instead of normal symbols.
   --extern-only      - Show only external symbols
+  -f                 - Alias for --format
   --format=<value>   - Specify output format
     =bsd             -   BSD format
     =sysv            -   System V format
     =posix           -   POSIX.2 format
     =darwin          -   Darwin -m format
     =just-symbols    -   just symbol names
+  -g                 - Alias for --extern-only
+  -j                 - Alias for --format-just-symbols
   --just-symbol-name - Alias for --format=just-symbols
   -m                 - Alias for --format=darwin
+  -n                 - Alias for --numeric-sort
   --no-demangle      - Don't demangle symbol names
   --no-dyldinfo      - Don't add any symbols from the dyldinfo, Mach-O only
   --no-llvm-bc       - Disable LLVM bitcode reader
   --no-sort          - Show symbols in order encountered
   --no-weak          - Show only non-weak symbols
   --numeric-sort     - Sort symbols by address
+  -o                 - Alias for --print-file-name
+  -p                 - Alias for --no-sort
   --portability      - Alias for --format=posix
   --print-armap      - Print the archive map
   --print-file-name  - Precede each symbol with the object file it came from
   --print-size       - Show symbol size as well as address
   --quiet            - Suppress 'no symbols' diagnostic
+  -r                 - Alias for --reverse-sort
   --radix=<value>    - Radix (o/d/x) for printing symbol Values
     =d               -   decimal
     =o               -   octal
@@ -49,7 +64,11 @@
   --reverse-sort     - Sort in reverse order
   --size-sort        - Sort symbols by size
   --special-syms     - Do not filter special symbols from the output
+  -t                 - Alias for --radix
+  -u                 - Alias for --undefined-only
   --undefined-only   - Show only undefined symbols
+  -v                 - Alias for --numeric-sort
+  --without-aliases  - Exclude aliases from output
   -x                 - Print symbol entry in hex, Mach-O only
 
 Pass @FILE as argument to read options from FILE.
This revision is now accepted and ready to land.May 7 2021, 1:52 PM
MaskRay accepted this revision.May 7 2021, 3:52 PM

Looks great!