xref: /freebsd-src/contrib/llvm-project/llvm/tools/llvm-readobj/Opts.td (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1fe6060f1SDimitry Andricinclude "llvm/Option/OptParser.td"
2fe6060f1SDimitry Andric
3fe6060f1SDimitry Andricclass F<string letter, string help> : Flag<["-"], letter>, HelpText<help>;
4fe6060f1SDimitry Andricclass FF<string name, string help> : Flag<["--"], name>, HelpText<help>;
5fe6060f1SDimitry Andric
6fe6060f1SDimitry Andricmulticlass BB<string name, string help1, string help2> {
7fe6060f1SDimitry Andric  def NAME: Flag<["--"], name>, HelpText<help1>;
8fe6060f1SDimitry Andric  def no_ # NAME: Flag<["--"], "no-" # name>, HelpText<help2>;
9fe6060f1SDimitry Andric}
10fe6060f1SDimitry Andric
11fe6060f1SDimitry Andricmulticlass Eq<string name, string help> {
12fe6060f1SDimitry Andric  def NAME #_EQ : Joined<["--"], name #"=">, HelpText<help>;
13fe6060f1SDimitry Andric  def : Separate<["--"], name>, Alias<!cast<Joined>(NAME #_EQ)>;
14fe6060f1SDimitry Andric}
15fe6060f1SDimitry Andric
16fe6060f1SDimitry Andricdef addrsig : FF<"addrsig", "Display address-significance table">;
17fe6060f1SDimitry Andricdef all : FF<"all", "Equivalent to setting: --file-header, --program-headers, --section-headers, "
18fe6060f1SDimitry Andric             "--symbols, --relocations, --dynamic-table, --notes, --version-info, --unwind, "
19fe6060f1SDimitry Andric             "--section-groups and --histogram">;
20fe6060f1SDimitry Andricdef arch_specific : FF<"arch-specific", "Display architecture-specific information">;
21fe6060f1SDimitry Andricdef bb_addr_map : FF<"bb-addr-map", "Display the BB address map section">;
22*0fca6ea1SDimitry Andricdef pretty_pgo_analysis_map : FF<"pretty-pgo-analysis-map", "Display PGO analysis values with formatting rather than raw numbers">;
23fe6060f1SDimitry Andricdef cg_profile : FF<"cg-profile", "Display call graph profile section">;
244c2d3b02SDimitry Andricdef decompress : FF<"decompress", "Dump decompressed section content when used with -x or -p">;
25fe6060f1SDimitry Andricdefm demangle : BB<"demangle", "Demangle symbol names", "Do not demangle symbol names (default)">;
26fe6060f1SDimitry Andricdef dependent_libraries : FF<"dependent-libraries", "Display the dependent libraries section">;
27fe6060f1SDimitry Andricdef dyn_relocations : FF<"dyn-relocations", "Display the dynamic relocation entries in the file">;
28fe6060f1SDimitry Andricdef dyn_syms : FF<"dyn-syms", "Display the dynamic symbol table">;
29fe6060f1SDimitry Andricdef expand_relocs : FF<"expand-relocs", "Expand each shown relocation to multiple lines">;
305f757f3fSDimitry Andricdef extra_sym_info : FF<"extra-sym-info", "Display extra information when showing symbols">;
31fe6060f1SDimitry Andricdef file_header : FF<"file-header", "Display file header">;
32fe6060f1SDimitry Andricdef headers : FF<"headers", "Equivalent to setting: --file-header, --program-headers, --section-headers">;
33fe6060f1SDimitry Andricdefm hex_dump : Eq<"hex-dump", "Display the specified section(s) as hexadecimal bytes">, MetaVarName<"<name or index>">;
340eae32dcSDimitry Andricdef pretty_print : FF<"pretty-print", "Pretty print JSON output">;
35fe6060f1SDimitry Andricdef relocs : FF<"relocs", "Display the relocation entries in the file">;
36349cc55cSDimitry Andricdef section_data : FF<"section-data", "Display section data for each section shown. This option has no effect for GNU style output">;
37fe6060f1SDimitry Andricdef section_details : FF<"section-details", "Display the section details">;
38fe6060f1SDimitry Andricdef section_headers : FF<"section-headers", "Display section headers">;
39fe6060f1SDimitry Andricdef section_mapping : FF<"section-mapping", "Display the section to segment mapping">;
40fe6060f1SDimitry Andricdef section_mapping_EQ_false : FF<"section-mapping=false", "Don't display the section to segment mapping">, Flags<[HelpHidden]>;
41349cc55cSDimitry Andricdef section_relocations : FF<"section-relocations", "Display relocations for each section shown. This option has no effect for GNU style output">;
42349cc55cSDimitry Andricdef section_symbols : FF<"section-symbols", "Display symbols for each section shown. This option has no effect for GNU style output">;
4381ad6265SDimitry Andricdefm sort_symbols : Eq<"sort-symbols", "Specify the keys to sort the symbols before displaying symtab">;
44349cc55cSDimitry Andricdef stack_sizes : FF<"stack-sizes", "Display contents of all stack sizes sections. This option has no effect for GNU style output">;
45fe6060f1SDimitry Andricdef stackmap : FF<"stackmap", "Display contents of stackmap section">;
46fe6060f1SDimitry Andricdefm string_dump : Eq<"string-dump", "Display the specified section(s) as a list of strings">, MetaVarName<"<name or index>">;
47fe6060f1SDimitry Andricdef string_table : FF<"string-table", "Display the string table (only for XCOFF now)">;
48fe6060f1SDimitry Andricdef symbols : FF<"symbols", "Display the symbol table. Also display the dynamic symbol table when using GNU output style for ELF">;
49fe6060f1SDimitry Andricdef unwind : FF<"unwind", "Display unwind information">;
50fe6060f1SDimitry Andric
51fe6060f1SDimitry Andric// ELF specific options.
52fe6060f1SDimitry Andricdef grp_elf : OptionGroup<"kind">, HelpText<"OPTIONS (ELF specific)">;
53fe6060f1SDimitry Andricdef dynamic_table : FF<"dynamic-table", "Display the dynamic section table">, Group<grp_elf>;
54fe6060f1SDimitry Andricdef elf_linker_options : FF<"elf-linker-options", "Display the .linker-options section">, Group<grp_elf>;
550eae32dcSDimitry Andricdefm elf_output_style : Eq<"elf-output-style", "Specify ELF dump style: LLVM, GNU, JSON">, Group<grp_elf>;
56fe6060f1SDimitry Andricdef histogram : FF<"histogram", "Display bucket list histogram for hash sections">, Group<grp_elf>;
57fe6060f1SDimitry Andricdef section_groups : FF<"section-groups", "Display section groups">, Group<grp_elf>;
58349cc55cSDimitry Andricdef gnu_hash_table : FF<"gnu-hash-table", "Display the GNU hash table for dynamic symbols">, Group<grp_elf>;
59fe6060f1SDimitry Andricdef hash_symbols : FF<"hash-symbols", "Display the dynamic symbols derived from the hash section">, Group<grp_elf>;
60fe6060f1SDimitry Andricdef hash_table : FF<"hash-table", "Display .hash section">, Group<grp_elf>;
6106c3fb27SDimitry Andricdef memtag : FF<"memtag", "Display memory tagging metadata (modes, Android notes, global descriptors)">, Group<grp_elf>;
62fe6060f1SDimitry Andricdef needed_libs : FF<"needed-libs", "Display the needed libraries">, Group<grp_elf>;
63fe6060f1SDimitry Andricdef notes : FF<"notes", "Display notes">, Group<grp_elf>;
64fe6060f1SDimitry Andricdef program_headers : FF<"program-headers", "Display program headers">, Group<grp_elf>;
65fe6060f1SDimitry Andricdef version_info : FF<"version-info", "Display version sections">, Group<grp_elf>;
66fe6060f1SDimitry Andric
67fe6060f1SDimitry Andric// Mach-O specific options.
68fe6060f1SDimitry Andricdef grp_mach_o : OptionGroup<"kind">, HelpText<"OPTIONS (Mach-O specific)">;
69fe6060f1SDimitry Andricdef macho_data_in_code : FF<"macho-data-in-code", "Display Data in Code command">, Group<grp_mach_o>;
70fe6060f1SDimitry Andricdef macho_dysymtab : FF<"macho-dysymtab", "Display Dysymtab command">, Group<grp_mach_o>;
71fe6060f1SDimitry Andricdef macho_indirect_symbols : FF<"macho-indirect-symbols", "Display indirect symbols">, Group<grp_mach_o>;
72fe6060f1SDimitry Andricdef macho_linker_options : FF<"macho-linker-options", "Display linker options">, Group<grp_mach_o>;
73fe6060f1SDimitry Andricdef macho_segment : FF<"macho-segment", "Display Segment command">, Group<grp_mach_o>;
74fe6060f1SDimitry Andricdef macho_version_min : FF<"macho-version-min", "Display version min command">, Group<grp_mach_o>;
75fe6060f1SDimitry Andric
76fe6060f1SDimitry Andric// PE/COFF specific options.
77fe6060f1SDimitry Andricdef grp_coff : OptionGroup<"kind">, HelpText<"OPTIONS (PE/COFF specific)">;
78fe6060f1SDimitry Andricdef codeview : FF<"codeview", "Display CodeView debug information">, Group<grp_coff>;
79fe6060f1SDimitry Andricdef codeview_ghash : FF<"codeview-ghash", "Enable global hashing for CodeView type stream de-duplication">, Group<grp_coff>;
80fe6060f1SDimitry Andricdef codeview_merged_types : FF<"codeview-merged-types", "Display the merged CodeView type stream">, Group<grp_coff>;
81fe6060f1SDimitry Andricdef codeview_subsection_bytes : FF<"codeview-subsection-bytes", "Dump raw contents of codeview debug sections and records">, Group<grp_coff>;
82fe6060f1SDimitry Andricdef coff_basereloc : FF<"coff-basereloc", "Display .reloc section">, Group<grp_coff>;
83fe6060f1SDimitry Andricdef coff_debug_directory : FF<"coff-debug-directory", "Display debug directory">, Group<grp_coff>;
84fe6060f1SDimitry Andricdef coff_directives : FF<"coff-directives", "Display .drectve section">, Group<grp_coff>;
85fe6060f1SDimitry Andricdef coff_exports : FF<"coff-exports", "Display export table">, Group<grp_coff>;
86fe6060f1SDimitry Andricdef coff_imports : FF<"coff-imports", "Display import table">, Group<grp_coff>;
87fe6060f1SDimitry Andricdef coff_load_config : FF<"coff-load-config", "Display load config">, Group<grp_coff>;
88fe6060f1SDimitry Andricdef coff_resources : FF<"coff-resources", "Display .rsrc section">, Group<grp_coff>;
89fe6060f1SDimitry Andricdef coff_tls_directory : FF<"coff-tls-directory", "Display TLS directory">, Group<grp_coff>;
90fe6060f1SDimitry Andric
91349cc55cSDimitry Andric// XCOFF specific options.
92349cc55cSDimitry Andricdef grp_xcoff : OptionGroup<"kind">, HelpText<"OPTIONS (XCOFF specific)">;
9381ad6265SDimitry Andricdef auxiliary_header : FF<"auxiliary-header" , "Display the auxiliary header">, Group<grp_xcoff>;
94bdd1243dSDimitry Andricdef exception_section : FF<"exception-section" , "Display the exception section entries">, Group<grp_xcoff>;
95bdd1243dSDimitry Andricdef loader_section_header : FF<"loader-section-header" , "Display the loader section header">, Group<grp_xcoff>;
96bdd1243dSDimitry Andricdef loader_section_symbols : FF<"loader-section-symbols" , "Display the loader section symbol table">, Group<grp_xcoff>;
97bdd1243dSDimitry Andricdef loader_section_relocations : FF<"loader-section-relocations" , "Display the loader section relocation entries">, Group<grp_xcoff>;
98349cc55cSDimitry Andric
99fe6060f1SDimitry Andricdef help : FF<"help", "Display this help">;
100fe6060f1SDimitry Andricdef version : FF<"version", "Display the version">;
101fe6060f1SDimitry Andric
102fe6060f1SDimitry Andric// Ignored for GNU readelf compatibility.
103349cc55cSDimitry Andricdef wide : FF<"wide", "Ignored for GNU readelf compatibility">;
104349cc55cSDimitry Andricdef : F<"W", "Ignored for GNU readelf compatibility">, Alias<wide>;
105fe6060f1SDimitry Andric
106fe6060f1SDimitry Andric// Traditional llvm-readobj Aliases.
107fe6060f1SDimitry Andricdef : Flag<["--"], "dt">, Alias<dyn_syms>, HelpText<"Alias for --dyn-syms">;
108fe6060f1SDimitry Andricdef : Flag<["--"], "sd">, Alias<section_data>, HelpText<"Alias for --section-data">;
109fe6060f1SDimitry Andricdef : Flag<["--"], "st">, Alias<section_symbols>, HelpText<"Alias for --section-symbols">;
110fe6060f1SDimitry Andricdef : Flag<["--"], "sr">, Alias<section_relocations>, HelpText<"Alias for --section-relocations">;
111fe6060f1SDimitry Andric
112fe6060f1SDimitry Andric// Aliases.
113fe6060f1SDimitry Andricdef : FF<"dyn-symbols", "Alias for --dyn-syms">, Alias<dyn_syms>;
114fe6060f1SDimitry Andricdef : FF<"dynamic", "Alias for --dynamic-table">, Alias<dynamic_table>;
115fe6060f1SDimitry Andricdef : FF<"elf-cg-profile", "Alias for --cg-profile">, Alias<cg_profile>, Flags<[HelpHidden]>;
116fe6060f1SDimitry Andricdef : FF<"elf-hash-histogram", "Alias for --histogram">, Alias<histogram>, Flags<[HelpHidden]>;
117fe6060f1SDimitry Andricdef : FF<"elf-section-groups", "Alias for --section-groups">, Alias<section_groups>, Flags<[HelpHidden]>;
118fe6060f1SDimitry Andricdef : FF<"file-headers", "Alias for --file-header">, Alias<file_header>, Flags<[HelpHidden]>;
119fe6060f1SDimitry Andricdef : FF<"relocations", "Alias for --relocs">, Alias<relocs>;
120fe6060f1SDimitry Andricdef : FF<"sections", "Alias for --section-headers">, Alias<section_headers>;
121fe6060f1SDimitry Andricdef : FF<"segments", "Alias for --program-headers">, Alias<program_headers>, Group<grp_elf>;
122fe6060f1SDimitry Andricdef : FF<"syms", "Alias for --symbols">, Alias<symbols>;
123fe6060f1SDimitry Andric
124fe6060f1SDimitry Andricdef : F<"A", "Alias for --arch-specific">, Alias<arch_specific>;
125fe6060f1SDimitry Andricdef : F<"a", "Alias for --all">, Alias<all>;
126fe6060f1SDimitry Andricdef : F<"C", "Alias for --demangle">, Alias<demangle>;
127fe6060f1SDimitry Andricdef : F<"d", "Alias for --dynamic-table">, Alias<dynamic_table>, Group<grp_elf>;
128fe6060f1SDimitry Andricdef : F<"e", "Alias for --headers">, Alias<headers>;
129fe6060f1SDimitry Andricdef : F<"g", "Alias for --section-groups">, Alias<section_groups>, Group<grp_elf>;
130fe6060f1SDimitry Andricdef : F<"h", "Alias for --file-header">, Alias<file_header>;
131fe6060f1SDimitry Andricdef : F<"I", "Alias for --histogram">, Alias<histogram>, Group<grp_elf>;
132fe6060f1SDimitry Andricdef : F<"l", "Alias for --program-headers">, Alias<program_headers>;
133fe6060f1SDimitry Andricdef : F<"n", "Alias for --notes">, Alias<notes>;
134fe6060f1SDimitry Andricdef : JoinedOrSeparate<["-"], "p">, Alias<string_dump_EQ>, HelpText<"Alias for --string-dump">, MetaVarName<"<name or index>">;
135fe6060f1SDimitry Andricdef : F<"r", "Alias for --relocs">, Alias<relocs>;
136fe6060f1SDimitry Andricdef : F<"S", "Alias for --section-headers">, Alias<section_headers>;
137fe6060f1SDimitry Andricdef : F<"s", "Alias for --symbols">, Alias<symbols>;
138fe6060f1SDimitry Andricdef : F<"t", "Alias for --section-details">, Alias<section_details>;
139fe6060f1SDimitry Andricdef : F<"u", "Alias for --unwind">, Alias<unwind>;
1405f757f3fSDimitry Andricdef : F<"X", "Alias for --extra-sym-info">, Alias<extra_sym_info>, Group<grp_elf>;
141fe6060f1SDimitry Andricdef : F<"V", "Alias for --version-info">, Alias<version_info>, Group<grp_elf>;
142fe6060f1SDimitry Andricdef : JoinedOrSeparate<["-"], "x">, Alias<hex_dump_EQ>, HelpText<"Alias for --hex-dump">, MetaVarName<"<name or index>">;
1434c2d3b02SDimitry Andricdef : F<"z", "Alias for --decompress">, Alias<decompress>;
144