[llvm-nm] Remove one-dash long options except -arch

The documentation and help messages have recommended the double-dash forms for
quite a while. Remove one-dash long options which are not recognized by GNU
style `getopt_long`.

`-arch` is kept as it is in the manpage of classic nm
https://keith.github.io/xcode-man-pages/nm.1.html

Note: the dyldinfo related options don't have a test.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D105948
This commit is contained in:
Fangrui Song 2021-07-15 09:50:37 -07:00
parent e5843d83d7
commit 5aac6f60bc
2 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
# RUN: llvm-nm -P %p/Inputs/hello.obj.elf-x86_64 > %t1
# RUN: llvm-nm --format=posix %p/Inputs/hello.obj.elf-x86_64 > %t2
# RUN: llvm-nm -portability %p/Inputs/hello.obj.elf-x86_64 > %t3
# RUN: llvm-nm --portability %p/Inputs/hello.obj.elf-x86_64 > %t3
# RUN: diff %t1 %t2
# RUN: diff %t1 %t3

View File

@ -1,17 +1,16 @@
include "llvm/Option/OptParser.td"
class F<string letter, string help> : Flag<["-"], letter>, HelpText<help>;
class FF<string name, string help> : Flag<["--", "-"], name>, HelpText<help>;
class FF<string name, string help> : Flag<["--"], name>, HelpText<help>;
multiclass BB<string name, string help1, string help2> {
def NAME: Flag<["--", "-"], name>, HelpText<help1>;
def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>;
def NAME: Flag<["--"], name>, HelpText<help1>;
def no_ # NAME: Flag<["--"], "no-" # name>, HelpText<help2>;
}
multiclass Eq<string name, string help> {
def NAME #_EQ : Joined<["--", "-"], name #"=">,
HelpText<help>;
def : Separate<["--", "-"], name>, Alias<!cast<Joined>(NAME #_EQ)>;
def NAME #_EQ : Joined<["--"], name #"=">, HelpText<help>;
def : Separate<["--"], name>, Alias<!cast<Joined>(NAME #_EQ)>;
}
def debug_syms : FF<"debug-syms", "Show all symbols, even debugger only">;
@ -42,7 +41,8 @@ def grp_mach_o : OptionGroup<"kind">, HelpText<"llvm-nm Mach-O Specific Options"
def add_dyldinfo : FF<"add-dyldinfo", "Add symbols from the dyldinfo not already in the symbol table">, Group<grp_mach_o>;
def add_inlinedinfo : FF<"add-inlinedinfo", "Add symbols from the inlined libraries, TBD only">, Group<grp_mach_o>;
defm arch : Eq<"arch", "architecture(s) from a Mach-O file to dump">, Group<grp_mach_o>;
def arch_EQ : Joined<["--"], "arch=">, HelpText<"architecture(s) from a Mach-O file to dump">, Group<grp_mach_o>;
def : Separate<["--", "-"], "arch">, Alias<arch_EQ>;
def dyldinfo_only : FF<"dyldinfo-only", "Show only symbols from the dyldinfo">, Group<grp_mach_o>;
def no_dyldinfo : FF<"no-dyldinfo", "Don't add any symbols from the dyldinfo">, Group<grp_mach_o>;
def s : F<"s", "Dump only symbols from this segment and section name">, Group<grp_mach_o>;