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