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