xref: /freebsd/contrib/llvm-project/llvm/tools/llvm-nm/Opts.td (revision c7a063741720ef81d4caa4613242579d12f1d605)
1include "llvm/Option/OptParser.td"
2
3class F<string letter, string help> : Flag<["-"], letter>, HelpText<help>;
4class FF<string name, string help> : Flag<["--"], name>, HelpText<help>;
5
6multiclass BB<string name, string help1, string help2> {
7  def NAME: Flag<["--"], name>, HelpText<help1>;
8  def no_ # NAME: Flag<["--"], "no-" # name>, HelpText<help2>;
9}
10
11multiclass Eq<string name, string help> {
12  def NAME #_EQ : Joined<["--"], name #"=">, HelpText<help>;
13  def : Separate<["--"], name>, Alias<!cast<Joined>(NAME #_EQ)>;
14}
15
16def debug_syms : FF<"debug-syms", "Show all symbols, even debugger only">;
17def defined_only : FF<"defined-only", "Show only defined symbols">;
18defm demangle : BB<"demangle", "Demangle C++ symbol names", "Don't demangle symbol names">;
19def dynamic : FF<"dynamic", "Display dynamic symbols instead of normal symbols">;
20def extern_only : FF<"extern-only", "Show only external symbols">;
21defm format : Eq<"format", "Specify output format: bsd (default), posix, sysv, darwin, just-symbols">, MetaVarName<"<format>">;
22def help : FF<"help", "Display this help">;
23def no_llvm_bc : FF<"no-llvm-bc", "Disable LLVM bitcode reader">;
24def no_sort : FF<"no-sort", "Show symbols in order encountered">;
25def no_weak : FF<"no-weak", "Show only non-weak symbols">;
26def numeric_sort : FF<"numeric-sort", "Sort symbols by address">;
27def print_armap : FF<"print-armap", "Print the archive map">;
28def print_file_name : FF<"print-file-name", "Precede each symbol with the object file it came from">;
29def print_size : FF<"print-size", "Show symbol size as well as address">;
30def quiet : FF<"quiet", "Suppress 'no symbols' diagnostic">;
31defm radix : Eq<"radix", "Radix (o/d/x) for printing symbol Values">, MetaVarName<"<radix>">;
32def reverse_sort : FF<"reverse-sort", "Sort in reverse order">;
33def size_sort : FF<"size-sort", "Sort symbols by size">;
34def special_syms : FF<"special-syms", "Do not filter special symbols from the output">;
35def undefined_only : FF<"undefined-only", "Show only undefined symbols">;
36def version : FF<"version", "Display the version">;
37def without_aliases : FF<"without-aliases", "Exclude aliases from output">, Flags<[HelpHidden]>;
38
39// Mach-O specific options.
40def grp_mach_o : OptionGroup<"kind">, HelpText<"llvm-nm Mach-O Specific Options">;
41
42def add_dyldinfo : FF<"add-dyldinfo", "Add symbols from the dyldinfo not already in the symbol table">, Group<grp_mach_o>;
43def add_inlinedinfo : FF<"add-inlinedinfo", "Add symbols from the inlined libraries, TBD only">, Group<grp_mach_o>;
44def arch_EQ : Joined<["--"], "arch=">, HelpText<"architecture(s) from a Mach-O file to dump">, Group<grp_mach_o>;
45def : Separate<["--", "-"], "arch">, Alias<arch_EQ>;
46def dyldinfo_only : FF<"dyldinfo-only", "Show only symbols from the dyldinfo">, Group<grp_mach_o>;
47def no_dyldinfo : FF<"no-dyldinfo", "Don't add any symbols from the dyldinfo">, Group<grp_mach_o>;
48def s : F<"s", "Dump only symbols from this segment and section name">, Group<grp_mach_o>;
49def x : F<"x", "Print symbol entry in hex">, Group<grp_mach_o>;
50
51def : FF<"just-symbol-name", "Alias for --format=just-symbols">, Alias<format_EQ>, AliasArgs<["just-symbols"]>, Flags<[HelpHidden]>;
52def : FF<"portability", "Alias for --format=posix">, Alias<format_EQ>, AliasArgs<["posix"]>;
53
54def : F<"a", "Alias for --debug-syms">, Alias<debug_syms>;
55def : F<"A", "Alias for --print-file-name">, Alias<print_file_name>;
56def : F<"B", "Alias for --format=bsd">, Alias<format_EQ>, AliasArgs<["bsd"]>;
57def : F<"C", "Alias for --demangle">, Alias<demangle>;
58def : F<"D", "Alias for --dynamic">, Alias<dynamic>;
59def : JoinedOrSeparate<["-"], "f">, HelpText<"Alias for --format">, Alias<format_EQ>, MetaVarName<"<format>">;
60def : F<"h", "Alias for --help">, Alias<help>;
61def : F<"g", "Alias for --extern-only">, Alias<extern_only>;
62def : F<"j", "Alias for --format=just-symbols">, Alias<format_EQ>, AliasArgs<["just-symbols"]>;
63def : F<"m", "Alias for --format=darwin">, Alias<format_EQ>, AliasArgs<["darwin"]>;
64def : F<"M", "Deprecated alias for --print-armap">, Alias<print_armap>, Flags<[HelpHidden]>;
65def : F<"n", "Alias for --numeric-sort">, Alias<numeric_sort>;
66def : F<"o", "Alias for --print-file-name">, Alias<print_file_name>;
67def : F<"p", "Alias for --no-sort">, Alias<no_sort>;
68def : F<"P", "Alias for --format=posix">, Alias<format_EQ>, AliasArgs<["posix"]>;
69def : F<"r", "Alias for --reverse-sort">, Alias<reverse_sort>;
70def : F<"S", "Alias for --print-size">, Alias<print_size>;
71def : JoinedOrSeparate<["-"], "t">, HelpText<"Alias for --radix">, Alias<radix_EQ>, MetaVarName<"<radix>">;
72def : F<"u", "Alias for --undefined-only">, Alias<undefined_only>;
73def : F<"U", "Deprecated alias for --defined-only">, Alias<defined_only>, Flags<[HelpHidden]>;
74def : F<"v", "Alias for --numeric-sort">, Alias<numeric_sort>;
75def : F<"V", "Alias for --version">, Alias<version>;
76def : F<"W", "Deprecated alias for --no-weak">, Alias<no_weak>, Flags<[HelpHidden]>;
77