xref: /freebsd/contrib/llvm-project/llvm/tools/llvm-nm/Opts.td (revision 7ef62cebc2f965b0f640263e179276928885e33d)
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 X : JoinedOrSeparate<["-"], "X">, HelpText<"Specifies the type of ELF, XCOFF, or IR object file to examine. The value must be one of: 32, 64, 32_64, any (default)">;
17def debug_syms : FF<"debug-syms", "Show all symbols, even debugger only">;
18def defined_only : FF<"defined-only", "Show only defined symbols">;
19defm demangle : BB<"demangle", "Demangle C++ symbol names", "Don't demangle symbol names">;
20def dynamic : FF<"dynamic", "Display dynamic symbols instead of normal symbols">;
21def export_symbols : FF<"export-symbols", "Export symbol list for all inputs">;
22def extern_only : FF<"extern-only", "Show only external symbols">;
23defm format : Eq<"format", "Specify output format: bsd (default), posix, sysv, darwin, just-symbols">, MetaVarName<"<format>">;
24def help : FF<"help", "Display this help">;
25def no_llvm_bc : FF<"no-llvm-bc", "Disable LLVM bitcode reader">;
26def no_sort : FF<"no-sort", "Show symbols in order encountered">;
27def no_weak : FF<"no-weak", "Show only non-weak symbols">;
28def numeric_sort : FF<"numeric-sort", "Sort symbols by address">;
29def print_armap : FF<"print-armap", "Print the archive map">;
30def print_file_name : FF<"print-file-name", "Precede each symbol with the object file it came from">;
31def print_size : FF<"print-size", "Show symbol size as well as address">;
32def quiet : FF<"quiet", "Suppress 'no symbols' diagnostic">;
33defm radix : Eq<"radix", "Radix (o/d/x) for printing symbol Values">, MetaVarName<"<radix>">;
34def reverse_sort : FF<"reverse-sort", "Sort in reverse order">;
35def size_sort : FF<"size-sort", "Sort symbols by size">;
36def special_syms : FF<"special-syms", "Do not filter special symbols from the output">;
37def undefined_only : FF<"undefined-only", "Show only undefined symbols">;
38def version : FF<"version", "Display the version">;
39def without_aliases : FF<"without-aliases", "Exclude aliases from output">, Flags<[HelpHidden]>;
40
41// Mach-O specific options.
42def grp_mach_o : OptionGroup<"kind">, HelpText<"llvm-nm Mach-O Specific Options">;
43
44def add_dyldinfo : FF<"add-dyldinfo", "Add symbols from the dyldinfo not already in the symbol table">, Group<grp_mach_o>;
45def add_inlinedinfo : FF<"add-inlinedinfo", "Add symbols from the inlined libraries, TBD only">, Group<grp_mach_o>;
46def arch_EQ : Joined<["--"], "arch=">, HelpText<"architecture(s) from a Mach-O file to dump">, Group<grp_mach_o>;
47def : Separate<["--", "-"], "arch">, Alias<arch_EQ>;
48def dyldinfo_only : FF<"dyldinfo-only", "Show only symbols from the dyldinfo">, Group<grp_mach_o>;
49def no_dyldinfo : FF<"no-dyldinfo", "Don't add any symbols from the dyldinfo">, Group<grp_mach_o>;
50def s : F<"s", "Dump only symbols from this segment and section name">, Group<grp_mach_o>;
51def x : F<"x", "Print symbol entry in hex">, Group<grp_mach_o>;
52
53// XCOFF specific options.
54def grp_xcoff_o : OptionGroup<"kind">, HelpText<"llvm-nm XCOFF Specific Options">;
55
56def no_rsrc : FF<"no-rsrc", "Exclude resource file symbols (__rsrc) from the export symbol list.">, Group<grp_xcoff_o>;
57
58def : FF<"just-symbol-name", "Alias for --format=just-symbols">, Alias<format_EQ>, AliasArgs<["just-symbols"]>, Flags<[HelpHidden]>;
59def : FF<"portability", "Alias for --format=posix">, Alias<format_EQ>, AliasArgs<["posix"]>;
60
61def : F<"a", "Alias for --debug-syms">, Alias<debug_syms>;
62def : F<"A", "Alias for --print-file-name">, Alias<print_file_name>;
63def : F<"B", "Alias for --format=bsd">, Alias<format_EQ>, AliasArgs<["bsd"]>;
64def : F<"C", "Alias for --demangle">, Alias<demangle>;
65def : F<"D", "Alias for --dynamic">, Alias<dynamic>;
66def : JoinedOrSeparate<["-"], "f">, HelpText<"Alias for --format">, Alias<format_EQ>, MetaVarName<"<format>">;
67def : F<"h", "Alias for --help">, Alias<help>;
68def : F<"g", "Alias for --extern-only">, Alias<extern_only>;
69def : F<"j", "Alias for --format=just-symbols">, Alias<format_EQ>, AliasArgs<["just-symbols"]>;
70def : F<"m", "Alias for --format=darwin">, Alias<format_EQ>, AliasArgs<["darwin"]>;
71def : F<"M", "Deprecated alias for --print-armap">, Alias<print_armap>, Flags<[HelpHidden]>;
72def : F<"n", "Alias for --numeric-sort">, Alias<numeric_sort>;
73def : F<"o", "Alias for --print-file-name">, Alias<print_file_name>;
74def : F<"p", "Alias for --no-sort">, Alias<no_sort>;
75def : F<"P", "Alias for --format=posix">, Alias<format_EQ>, AliasArgs<["posix"]>;
76def : F<"r", "Alias for --reverse-sort">, Alias<reverse_sort>;
77def : F<"S", "Alias for --print-size">, Alias<print_size>;
78def : JoinedOrSeparate<["-"], "t">, HelpText<"Alias for --radix">, Alias<radix_EQ>, MetaVarName<"<radix>">;
79def : F<"u", "Alias for --undefined-only">, Alias<undefined_only>;
80def : F<"U", "Alias for --defined-only">, Alias<defined_only>;
81def : F<"v", "Alias for --numeric-sort">, Alias<numeric_sort>;
82def : F<"V", "Alias for --version">, Alias<version>;
83def : F<"W", "Alias for --no-weak">, Alias<no_weak>;
84