xref: /freebsd/contrib/llvm-project/llvm/tools/llvm-objdump/ObjdumpOpts.td (revision f81cdf24ba5436367377f7c8e8f51f6df2a75ca7)
1include "llvm/Option/OptParser.td"
2
3multiclass B<string name, string help1, string help2> {
4  def NAME: Flag<["--"], name>, HelpText<help1>;
5  def no_ # NAME: Flag<["--"], "no-" # name>, HelpText<help2>;
6}
7
8multiclass Eq<string name, string help> {
9  def NAME : Separate<["--"], name>;
10  def NAME #_eq : Joined<["--"], name #"=">,
11                  Alias<!cast<Separate>(NAME)>,
12                  HelpText<help>;
13}
14
15def help : Flag<["--"], "help">,
16  HelpText<"Display available options (--help-hidden for more)">;
17
18def help_hidden : Flag<["--"], "help-hidden">,
19  Flags<[HelpHidden]>,
20  HelpText<"Display all available options">;
21
22def version : Flag<["--"], "version">,
23  HelpText<"Display the version of this program">;
24def : Flag<["-"], "v">, Alias<version>, HelpText<"Alias for --version">;
25
26def adjust_vma_EQ : Joined<["--"], "adjust-vma=">,
27  MetaVarName<"offset">,
28  HelpText<"Increase the displayed address by the specified offset">;
29
30def all_headers : Flag<["--"], "all-headers">,
31  HelpText<"Display all available header information, "
32           "relocation entries and the symbol table">;
33def : Flag<["-"], "x">, Alias<all_headers>, HelpText<"Alias for --all-headers">;
34
35def arch_name_EQ : Joined<["--"], "arch-name=">,
36  HelpText<"Target arch to disassemble for, "
37            "see --version for available targets">;
38def archive_headers : Flag<["--"], "archive-headers">,
39  HelpText<"Display archive header information">;
40
41defm build_id :
42  Eq<"build-id", "Build ID to look up. Once found, added as an input file">,
43  MetaVarName<"<hex>">;
44
45def : Flag<["-"], "a">, Alias<archive_headers>,
46  HelpText<"Alias for --archive-headers">;
47
48def demangle : Flag<["--"], "demangle">, HelpText<"Demangle symbol names">;
49def : Flag<["-"], "C">, Alias<demangle>, HelpText<"Alias for --demangle">;
50
51defm debug_file_directory :
52  Eq<"debug-file-directory", "Path to directory where to look for debug files">,
53  MetaVarName<"<dir>">;
54
55defm debuginfod : B<"debuginfod", "Use debuginfod to find debug files", "Don't use debuginfod to find debug files">;
56
57def disassemble : Flag<["--"], "disassemble">,
58  HelpText<"Disassemble all executable sections found in the input files">;
59def : Flag<["-"], "d">, Alias<disassemble>, HelpText<"Alias for --disassemble">;
60
61def disassemble_all : Flag<["--"], "disassemble-all">,
62  HelpText<"Disassemble all sections found in the input files">;
63def : Flag<["-"], "D">, Alias<disassemble_all>,
64  HelpText<"Alias for --disassemble-all">;
65
66def symbol_description : Flag<["--"], "symbol-description">,
67  HelpText<"Add symbol description for disassembly. This "
68           "option is for XCOFF files only">;
69
70def traceback_table : Flag<["--"], "traceback-table">,
71  HelpText<"Decode traceback table in disassembly. Implies --disassemble. "
72           "This option is for XCOFF files only">;
73
74def disassemble_symbols_EQ : Joined<["--"], "disassemble-symbols=">,
75  HelpText<"List of symbols to disassemble. "
76           "Accept demangled names when --demangle is "
77           "specified, otherwise accept mangled names">;
78
79def disassemble_zeroes : Flag<["--"], "disassemble-zeroes">,
80  HelpText<"Do not skip blocks of zeroes when disassembling">;
81def : Flag<["-"], "z">, Alias<disassemble_zeroes>,
82  HelpText<"Alias for --disassemble-zeroes">;
83
84def disassembler_options_EQ : Joined<["--"], "disassembler-options=">,
85  MetaVarName<"options">,
86  HelpText<"Pass target specific disassembler options">;
87def : JoinedOrSeparate<["-"], "M">, Alias<disassembler_options_EQ>,
88  HelpText<"Alias for --disassembler-options=">;
89
90def dynamic_reloc : Flag<["--"], "dynamic-reloc">,
91  HelpText<"Display the dynamic relocation entries in the file">;
92def : Flag<["-"], "R">, Alias<dynamic_reloc>,
93  HelpText<"Alias for --dynamic-reloc">;
94
95def dwarf_EQ : Joined<["--"], "dwarf=">,
96  HelpText<"Dump the specified DWARF debug sections. The "
97           "only supported value is 'frames'">,
98  Values<"frames">;
99
100def fault_map_section : Flag<["--"], "fault-map-section">,
101  HelpText<"Display the content of the fault map section">;
102
103def offloading : Flag<["--"], "offloading">,
104  HelpText<"Display the content of the offloading section">;
105
106def file_headers : Flag<["--"], "file-headers">,
107  HelpText<"Display the contents of the overall file header">;
108def : Flag<["-"], "f">, Alias<file_headers>,
109  HelpText<"Alias for --file-headers">;
110
111def full_contents : Flag<["--"], "full-contents">,
112  HelpText<"Display the content of each section">;
113def : Flag<["-"], "s">, Alias<full_contents>,
114  HelpText<"Alias for --full-contents">;
115
116def line_numbers : Flag<["--"], "line-numbers">,
117  HelpText<"When disassembling, display source line numbers. "
118           "Implies --disassemble">;
119def : Flag<["-"], "l">,
120  Alias<line_numbers>,
121  HelpText<"Alias for --line-numbers">;
122
123def macho : Flag<["--"], "macho">,
124  HelpText<"Use MachO specific object file parser">;
125def : Flag<["-"], "m">, Alias<macho>, HelpText<"Alias for --macho">;
126
127def mcpu_EQ : Joined<["--"], "mcpu=">,
128  MetaVarName<"cpu-name">,
129  HelpText<"Target a specific cpu type (--mcpu=help for details)">;
130
131def mattr_EQ : Joined<["--"], "mattr=">,
132  MetaVarName<"a1,+a2,-a3,...">,
133  HelpText<"Target specific attributes (--mattr=help for details)">;
134
135def no_show_raw_insn : Flag<["--"], "no-show-raw-insn">,
136  HelpText<"When disassembling instructions, "
137           "do not print the instruction bytes.">;
138
139def no_leading_addr : Flag<["--"], "no-leading-addr">,
140  HelpText<"When disassembling, do not print leading addresses for instructions or inline relocations">;
141def : Flag<["--"], "no-addresses">, Alias<no_leading_addr>,
142  HelpText<"Alias for --no-leading-addr">;
143
144def raw_clang_ast : Flag<["--"], "raw-clang-ast">,
145  HelpText<"Dump the raw binary contents of the clang AST section">;
146
147def reloc : Flag<["--"], "reloc">,
148  HelpText<"Display the relocation entries in the file">;
149def : Flag<["-"], "r">, Alias<reloc>, HelpText<"Alias for --reloc">;
150
151def print_imm_hex : Flag<["--"], "print-imm-hex">,
152  HelpText<"Use hex format for immediate values (default)">;
153
154def no_print_imm_hex : Flag<["--"], "no-print-imm-hex">,
155  HelpText<"Do not use hex format for immediate values">;
156def : Flag<["--"], "print-imm-hex=false">, Alias<no_print_imm_hex>;
157
158def private_headers : Flag<["--"], "private-headers">,
159  HelpText<"Display format specific file headers">;
160def : Flag<["-"], "p">, Alias<private_headers>,
161  HelpText<"Alias for --private-headers">;
162
163def section_EQ : Joined<["--"], "section=">,
164  HelpText<"Operate on the specified sections only. "
165           "With --macho dump segment,section">;
166def : Separate<["--"], "section">, Alias<section_EQ>;
167def : JoinedOrSeparate<["-"], "j">, Alias<section_EQ>,
168  HelpText<"Alias for --section">;
169
170def section_headers : Flag<["--"], "section-headers">,
171  HelpText<"Display summaries of the headers for each section.">;
172def : Flag<["--"], "headers">, Alias<section_headers>,
173  HelpText<"Alias for --section-headers">;
174def : Flag<["-"], "h">, Alias<section_headers>,
175  HelpText<"Alias for --section-headers">;
176
177def show_all_symbols : Flag<["--"], "show-all-symbols">,
178  HelpText<"Show all symbols during disassembly, even if multiple "
179           "symbols are defined at the same location">;
180
181def show_lma : Flag<["--"], "show-lma">,
182  HelpText<"Display LMA column when dumping ELF section headers">;
183
184def source : Flag<["--"], "source">,
185  HelpText<"When disassembling, display source interleaved with the "
186           "disassembly. Implies --disassemble">;
187def : Flag<["-"], "S">, Alias<source>, HelpText<"Alias for --source">;
188
189def start_address_EQ : Joined<["--"], "start-address=">,
190  MetaVarName<"address">,
191  HelpText<"Set the start address for disassembling, "
192           "printing relocations and printing symbols">;
193def stop_address_EQ : Joined<["--"], "stop-address=">,
194  MetaVarName<"address">,
195  HelpText<"Set the stop address for disassembling, "
196           "printing relocations and printing symbols">;
197
198def syms : Flag<["--"], "syms">,
199  HelpText<"Display the symbol table">;
200def : Flag<["-"], "t">, Alias<syms>, HelpText<"Alias for --syms">;
201
202def symbolize_operands : Flag<["--"], "symbolize-operands">,
203  HelpText<"Symbolize instruction operands when disassembling">;
204
205def dynamic_syms : Flag<["--"], "dynamic-syms">,
206  HelpText<"Display the contents of the dynamic symbol table">;
207def : Flag<["-"], "T">, Alias<dynamic_syms>,
208  HelpText<"Alias for --dynamic-syms">;
209
210def triple_EQ : Joined<["--"], "triple=">,
211  HelpText<"Target triple to disassemble for, "
212            "see --version for available targets">;
213def : Separate<["--"], "triple">,
214  Alias<triple_EQ>;
215
216def unwind_info : Flag<["--"], "unwind-info">,
217  HelpText<"Display unwind information">;
218def : Flag<["-"], "u">, Alias<unwind_info>,
219  HelpText<"Alias for --unwind-info">;
220
221def wide : Flag<["--"], "wide">,
222  HelpText<"Ignored for compatibility with GNU objdump">;
223def : Flag<["-"], "w">, Alias<wide>;
224
225defm prefix : Eq<"prefix", "Add prefix to absolute paths">,
226              MetaVarName<"prefix">;
227defm prefix_strip
228    : Eq<"prefix-strip", "Strip out initial directories from absolute "
229                         "paths. No effect without --prefix">,
230      MetaVarName<"prefix">;
231
232def debug_vars_EQ : Joined<["--"], "debug-vars=">,
233  HelpText<"Print the locations (in registers or memory) of "
234           "source-level variables alongside disassembly. "
235           "Supported formats: ascii, unicode (default)">,
236  Values<"unicode,ascii">;
237def : Flag<["--"], "debug-vars">, Alias<debug_vars_EQ>, AliasArgs<["unicode"]>;
238
239def debug_vars_indent_EQ : Joined<["--"], "debug-vars-indent=">,
240  HelpText<"Distance to indent the source-level variable display, "
241           "relative to the start of the disassembly">;
242
243def x86_asm_syntax_att : Flag<["--"], "x86-asm-syntax=att">,
244  HelpText<"Emit AT&T-style disassembly">;
245
246def x86_asm_syntax_intel : Flag<["--"], "x86-asm-syntax=intel">,
247  HelpText<"Emit Intel-style disassembly">;
248
249
250def grp_mach_o : OptionGroup<"kind">, HelpText<"llvm-objdump MachO Specific Options">;
251
252def private_header : Flag<["--"], "private-header">,
253  HelpText<"Display only the first format specific file header">,
254  Group<grp_mach_o>;
255
256def exports_trie : Flag<["--"], "exports-trie">,
257  HelpText<"Display mach-o exported symbols">,
258  Group<grp_mach_o>;
259
260def rebase : Flag<["--"], "rebase">,
261  HelpText<"Display mach-o rebasing info">,
262  Group<grp_mach_o>;
263
264def bind : Flag<["--"], "bind">,
265  HelpText<"Display mach-o binding info">,
266  Group<grp_mach_o>;
267
268def lazy_bind : Flag<["--"], "lazy-bind">,
269  HelpText<"Display mach-o lazy binding info">,
270  Group<grp_mach_o>;
271
272def weak_bind : Flag<["--"], "weak-bind">,
273  HelpText<"Display mach-o weak binding info">,
274  Group<grp_mach_o>;
275
276def g : Flag<["-"], "g">,
277  HelpText<"Print line information from debug info if available">,
278  Group<grp_mach_o>;
279
280def dsym_EQ : Joined<["--"], "dsym=">,
281  HelpText<"Use .dSYM file for debug info">,
282  Group<grp_mach_o>;
283def : Separate<["--"], "dsym">,
284  Alias<dsym_EQ>,
285  Group<grp_mach_o>;
286
287def full_leading_addr : Flag<["--"], "full-leading-addr">,
288  HelpText<"Print full leading address">,
289  Group<grp_mach_o>;
290
291def no_leading_headers : Flag<["--"], "no-leading-headers">,
292  HelpText<"Print no leading headers">,
293  Group<grp_mach_o>;
294
295def universal_headers : Flag<["--"], "universal-headers">,
296  HelpText<"Print Mach-O universal headers (requires --macho)">,
297  Group<grp_mach_o>;
298
299def archive_member_offsets : Flag<["--"], "archive-member-offsets">,
300  HelpText<"Print the offset to each archive member for Mach-O archives "
301           "(requires --macho and --archive-headers)">,
302  Group<grp_mach_o>;
303
304def indirect_symbols : Flag<["--"], "indirect-symbols">,
305  HelpText<"Print indirect symbol table for Mach-O objects (requires --macho)">,
306  Group<grp_mach_o>;
307
308def data_in_code : Flag<["--"], "data-in-code">,
309  HelpText<"Print the data in code table for Mach-O objects (requires --macho)">,
310  Group<grp_mach_o>;
311
312def function_starts_EQ : Joined<["--"], "function-starts=">,
313  HelpText<"Print the function starts table for Mach-O objects. "
314           "Options: addrs (default), names, both (requires --macho)">,
315  Values<"addrs,names,both">,
316  Group<grp_mach_o>;
317
318def : Flag<["--"], "function-starts">, Alias<function_starts_EQ>,
319  AliasArgs<["addrs"]>, Group<grp_mach_o>;
320
321def link_opt_hints : Flag<["--"], "link-opt-hints">,
322  HelpText<"Print the linker optimization hints for "
323           "Mach-O objects (requires --macho)">,
324  Group<grp_mach_o>;
325
326def info_plist : Flag<["--"], "info-plist">,
327  HelpText<"Print the info plist section as strings for "
328           "Mach-O objects (requires --macho)">,
329  Group<grp_mach_o>;
330
331def chained_fixups : Flag<["--"], "chained-fixups">,
332  HelpText<"Print chained fixup information (requires --macho)">,
333  Group<grp_mach_o>;
334
335def dyld_info : Flag<["--"], "dyld-info">,
336  HelpText<"Print bind and rebase information used by dyld to resolve "
337           "external references in a final linked binary "
338           "(requires --macho)">,
339  Group<grp_mach_o>;
340
341def dylibs_used : Flag<["--"], "dylibs-used">,
342  HelpText<"Print the shared libraries used for linked "
343           "Mach-O files (requires --macho)">,
344  Group<grp_mach_o>;
345
346def dylib_id : Flag<["--"], "dylib-id">,
347  HelpText<"Print the shared library's id for the "
348           "dylib Mach-O file (requires --macho)">,
349  Group<grp_mach_o>;
350
351def rpaths : Flag<["--"], "rpaths">,
352  HelpText<"Print the runtime search paths for the "
353           "Mach-O file (requires --macho)">,
354  Group<grp_mach_o>;
355
356def non_verbose : Flag<["--"], "non-verbose">,
357  HelpText<"Print the info for Mach-O objects in non-verbose or "
358           "numeric form (requires --macho)">,
359  Group<grp_mach_o>;
360
361def objc_meta_data : Flag<["--"], "objc-meta-data">,
362  HelpText<"Print the Objective-C runtime meta data "
363           "for Mach-O files (requires --macho)">,
364  Group<grp_mach_o>;
365
366def dis_symname : Separate<["--"], "dis-symname">,
367  HelpText<"disassemble just this symbol's instructions (requires --macho)">,
368  Group<grp_mach_o>;
369
370def no_symbolic_operands : Flag<["--"], "no-symbolic-operands">,
371  HelpText<"do not symbolic operands when disassembling (requires --macho)">,
372  Group<grp_mach_o>;
373
374def arch_EQ : Joined<["--"], "arch=">,
375  HelpText<"architecture(s) from a Mach-O file to dump">,
376  Group<grp_mach_o>;
377def : Separate<["--"], "arch">,
378  Alias<arch_EQ>,
379  Group<grp_mach_o>;
380