xref: /llvm-project-15.0.7/lld/ELF/Options.td (revision fbdcfcd4)
1include "llvm/Option/OptParser.td"
2
3// For options whose names are multiple letters, either one dash or
4// two can precede the option name except those that start with 'o'.
5class F<string name>: Flag<["--", "-"], name>;
6class J<string name>: Joined<["--", "-"], name>;
7
8multiclass Eq<string name, string help> {
9  def NAME: Separate<["--", "-"], name>;
10  def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>,
11    HelpText<help>;
12}
13
14multiclass B<string name, string help1, string help2> {
15  def NAME: Flag<["--", "-"], name>, HelpText<help1>;
16  def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>;
17}
18
19defm auxiliary: Eq<"auxiliary", "Set DT_AUXILIARY field to the specified name">;
20
21def Bsymbolic: F<"Bsymbolic">, HelpText<"Bind defined symbols locally">;
22
23def Bsymbolic_functions: F<"Bsymbolic-functions">,
24  HelpText<"Bind defined function symbols locally">;
25
26def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries (default)">;
27
28def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">;
29
30def build_id: F<"build-id">, HelpText<"Alias for --build-id=fast">;
31
32def build_id_eq: J<"build-id=">, HelpText<"Generate build ID note">,
33  MetaVarName<"[fast,md5,sha1,uuid,0x<hexstring>]">;
34
35defm check_sections: B<"check-sections",
36    "Check section addresses for overlaps (default)",
37    "Do not check section addresses for overlaps">;
38
39defm compress_debug_sections:
40  Eq<"compress-debug-sections", "Compress DWARF debug sections">,
41  MetaVarName<"[none,zlib]">;
42
43defm defsym: Eq<"defsym", "Define a symbol alias">, MetaVarName<"<symbol>=<value>">;
44
45defm optimize_bb_jumps: B<"optimize-bb-jumps",
46    "Remove direct jumps at the end to the next basic block",
47    "Do not remove any direct jumps at the end to the next basic block (default)">;
48
49defm split_stack_adjust_size
50    : Eq<"split-stack-adjust-size",
51         "Specify adjustment to stack size when a split-stack function calls a "
52         "non-split-stack function">,
53      MetaVarName<"<value>">;
54
55defm library_path:
56  Eq<"library-path", "Add a directory to the library search path">, MetaVarName<"<dir>">;
57
58def O: JoinedOrSeparate<["-"], "O">, HelpText<"Optimize output file size">;
59
60defm Tbss: Eq<"Tbss", "Same as --section-start with .bss as the sectionname">;
61
62defm Tdata: Eq<"Tdata", "Same as --section-start with .data as the sectionname">;
63
64defm Ttext: Eq<"Ttext", "Same as --section-start with .text as the sectionname">;
65
66def Ttext_segment: Separate<["-", "--"], "Ttext-segment">;
67
68defm allow_multiple_definition: B<"allow-multiple-definition",
69    "Allow multiple definitions",
70    "Do not allow multiple definitions (default)">;
71
72defm allow_shlib_undefined: B<"allow-shlib-undefined",
73    "Allow unresolved references in shared libraries (default when linking a shared library)",
74    "Do not allow unresolved references in shared libraries (default when linking an executable)">;
75
76defm apply_dynamic_relocs: B<"apply-dynamic-relocs",
77    "Apply link-time values for dynamic relocations",
78    "Do not apply link-time values for dynamic relocations (default)">;
79
80defm dependent_libraries: B<"dependent-libraries",
81    "Process dependent library specifiers from input files (default)",
82    "Ignore dependent library specifiers from input files">;
83
84defm as_needed: B<"as-needed",
85    "Only set DT_NEEDED for shared libraries if used",
86    "Always set DT_NEEDED for shared libraries (default)">;
87
88defm call_graph_ordering_file:
89  Eq<"call-graph-ordering-file", "Layout sections to optimize the given callgraph">;
90
91defm call_graph_profile_sort: B<"call-graph-profile-sort",
92    "Reorder sections with call graph profile (default)",
93    "Do not reorder sections with call graph profile">;
94
95// -chroot doesn't have a help text because it is an internal option.
96def chroot: Separate<["--", "-"], "chroot">;
97
98def color_diagnostics: F<"color-diagnostics">,
99  HelpText<"Alias for --color-diagnostics=always">;
100
101def color_diagnostics_eq: J<"color-diagnostics=">,
102  HelpText<"Use colors in diagnostics">,
103  MetaVarName<"[auto,always,never]">;
104
105defm cref: B<"cref",
106    "Output cross reference table",
107    "Do not output cross reference table">;
108
109defm define_common: B<"define-common",
110    "Assign space to common symbols",
111    "Do not assign space to common symbols">;
112
113defm demangle: B<"demangle",
114    "Demangle symbol names (default)",
115    "Do not demangle symbol names">;
116
117def disable_new_dtags: F<"disable-new-dtags">,
118  HelpText<"Disable new dynamic tags">;
119
120def discard_all: F<"discard-all">, HelpText<"Delete all local symbols">;
121
122def discard_locals: F<"discard-locals">,
123  HelpText<"Delete temporary local symbols">;
124
125def discard_none: F<"discard-none">,
126  HelpText<"Keep all symbols in the symbol table">;
127
128defm dynamic_linker: Eq<"dynamic-linker", "Which dynamic linker to use">;
129
130defm dynamic_list: Eq<"dynamic-list", "Read a list of dynamic symbols">;
131
132defm eh_frame_hdr: B<"eh-frame-hdr",
133    "Request creation of .eh_frame_hdr section and PT_GNU_EH_FRAME segment header",
134    "Do not create .eh_frame_hdr section">;
135
136def emit_relocs: F<"emit-relocs">, HelpText<"Generate relocations in output">;
137
138def enable_new_dtags: F<"enable-new-dtags">,
139  HelpText<"Enable new dynamic tags (default)">;
140
141def end_group: F<"end-group">,
142  HelpText<"Ignored for compatibility with GNU unless you pass --warn-backrefs">;
143
144def end_lib: F<"end-lib">,
145  HelpText<"End a grouping of objects that should be treated as if they were together in an archive">;
146
147defm entry: Eq<"entry", "Name of entry point symbol">,
148  MetaVarName<"<entry>">;
149
150defm error_limit:
151  Eq<"error-limit", "Maximum number of errors to emit before stopping (0 = no limit)">;
152
153def error_unresolved_symbols: F<"error-unresolved-symbols">,
154  HelpText<"Report unresolved symbols as errors">;
155
156defm exclude_libs: Eq<"exclude-libs", "Exclude static libraries from automatic export">;
157
158defm execute_only: B<"execute-only",
159    "Mark executable sections unreadable",
160    "Mark executable sections readable (default)">;
161
162defm export_dynamic: B<"export-dynamic",
163    "Put symbols in the dynamic symbol table",
164    "Do not put symbols in the dynamic symbol table (default)">;
165
166defm export_dynamic_symbol:
167  Eq<"export-dynamic-symbol", "Put a symbol in the dynamic symbol table">;
168
169defm fatal_warnings: B<"fatal-warnings",
170    "Treat warnings as errors",
171    "Do not treat warnings as errors (default)">;
172
173defm filter: Eq<"filter", "Set DT_FILTER field to the specified name">;
174
175defm fini: Eq<"fini", "Specify a finalizer function">, MetaVarName<"<symbol>">;
176
177def fix_cortex_a53_843419: F<"fix-cortex-a53-843419">,
178  HelpText<"Apply fixes for AArch64 Cortex-A53 erratum 843419">;
179
180def fix_cortex_a8: F<"fix-cortex-a8">,
181  HelpText<"Apply fixes for ARM Cortex-A8 erratum 657417">;
182
183defm format: Eq<"format", "Change the input format of the inputs following this option">,
184  MetaVarName<"[default,elf,binary]">;
185
186defm gc_sections: B<"gc-sections",
187    "Enable garbage collection of unused sections",
188    "Disable garbage collection of unused sections (default)">;
189
190defm gdb_index: B<"gdb-index",
191    "Generate .gdb_index section",
192    "Do not generate .gdb_index section (default)">;
193
194defm gnu_unique: B<"gnu-unique",
195  "Enable STB_GNU_UNIQUE symbol binding (default)",
196  "Disable STB_GNU_UNIQUE symbol binding">;
197
198defm hash_style: Eq<"hash-style", "Specify hash style (sysv, gnu or both)">;
199
200def help: F<"help">, HelpText<"Print option help">;
201
202def icf_all: F<"icf=all">, HelpText<"Enable identical code folding">;
203
204def icf_safe: F<"icf=safe">, HelpText<"Enable safe identical code folding">;
205
206def icf_none: F<"icf=none">, HelpText<"Disable identical code folding (default)">;
207
208def ignore_function_address_equality: F<"ignore-function-address-equality">,
209  HelpText<"lld can break the address equality of functions">;
210
211def ignore_data_address_equality: F<"ignore-data-address-equality">,
212  HelpText<"lld can break the address equality of data">;
213
214defm image_base: Eq<"image-base", "Set the base address">;
215
216defm init: Eq<"init", "Specify an initializer function">,
217  MetaVarName<"<symbol>">;
218
219defm just_symbols: Eq<"just-symbols", "Just link symbols">;
220
221defm keep_unique: Eq<"keep-unique", "Do not fold this symbol during ICF">;
222
223defm library: Eq<"library", "Root name of library to use">,
224  MetaVarName<"<libName>">;
225
226def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;
227
228defm Map: Eq<"Map", "Print a link map to the specified file">;
229
230defm merge_exidx_entries: B<"merge-exidx-entries",
231    "Enable merging .ARM.exidx entries (default)",
232    "Disable merging .ARM.exidx entries">;
233
234defm mmap_output_file: B<"mmap-output-file",
235    "Mmap the output file for writing (default)",
236    "Do not mmap the output file for writing">;
237
238def nmagic: F<"nmagic">, MetaVarName<"<magic>">,
239  HelpText<"Do not page align sections, link against static libraries.">;
240
241def nostdlib: F<"nostdlib">,
242  HelpText<"Only search directories specified on the command line">;
243
244def no_color_diagnostics: F<"no-color-diagnostics">,
245  HelpText<"Do not use colors in diagnostics">;
246
247def no_dynamic_linker: F<"no-dynamic-linker">,
248  HelpText<"Inhibit output of .interp section">;
249
250def noinhibit_exec: F<"noinhibit-exec">,
251  HelpText<"Retain the executable output file whenever it is still usable">;
252
253def no_nmagic: F<"no-nmagic">, MetaVarName<"<magic>">,
254  HelpText<"Page align sections (default)">;
255
256def no_omagic: F<"no-omagic">, MetaVarName<"<magic>">,
257  HelpText<"Do not set the text data sections to be writable, page align sections (default)">;
258
259def no_undefined: F<"no-undefined">,
260  HelpText<"Report unresolved symbols even if the linker is creating a shared library">;
261
262def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
263  HelpText<"Path to file to write output">;
264
265def oformat: Separate<["--"], "oformat">, MetaVarName<"<format>">,
266  HelpText<"Specify the binary format for the output object file">;
267
268def omagic: Flag<["--"], "omagic">, MetaVarName<"<magic>">,
269  HelpText<"Set the text and data sections to be readable and writable, do not page align sections, link against static libraries">;
270
271defm orphan_handling:
272  Eq<"orphan-handling", "Control how orphan sections are handled when linker script used">;
273
274defm pack_dyn_relocs:
275  Eq<"pack-dyn-relocs", "Pack dynamic relocations in the given format">,
276  MetaVarName<"[none,android,relr,android+relr]">;
277
278defm use_android_relr_tags: B<"use-android-relr-tags",
279    "Use SHT_ANDROID_RELR / DT_ANDROID_RELR* tags instead of SHT_RELR / DT_RELR*",
280    "Use SHT_RELR / DT_RELR* tags (default)">;
281
282def pic_veneer: F<"pic-veneer">,
283  HelpText<"Always generate position independent thunks (veneers)">;
284
285defm pie: B<"pie",
286    "Create a position independent executable",
287    "Do not create a position independent executable (default)">;
288
289defm print_gc_sections: B<"print-gc-sections",
290    "List removed unused sections",
291    "Do not list removed unused sections (default)">;
292
293defm print_icf_sections: B<"print-icf-sections",
294    "List identical folded sections",
295    "Do not list identical folded sections (default)">;
296
297def print_archive_stats: J<"print-archive-stats=">,
298  HelpText<"Write archive usage statistics to the specified file. "
299           "Print the numbers of members and fetched members for each archive">;
300
301defm print_symbol_order: Eq<"print-symbol-order",
302  "Print a symbol order specified by --call-graph-ordering-file into the specified file">;
303
304def pop_state: F<"pop-state">,
305  HelpText<"Undo the effect of -push-state">;
306
307def push_state: F<"push-state">,
308  HelpText<"Save the current state of -as-needed, -static and -whole-archive">;
309
310def print_map: F<"print-map">,
311  HelpText<"Print a link map to the standard output">;
312
313defm reproduce: Eq<"reproduce", "Write a tar file containing input files and command line options to reproduce link">;
314
315defm rosegment: B<"rosegment",
316  "Put read-only non-executable sections in their own segment (default)",
317  "Do not put read-only non-executable sections in their own segment">;
318
319defm rpath: Eq<"rpath", "Add a DT_RUNPATH to the output">;
320
321def relocatable: F<"relocatable">, HelpText<"Create relocatable object file">;
322
323defm retain_symbols_file:
324  Eq<"retain-symbols-file", "Retain only the symbols listed in the file">,
325  MetaVarName<"<file>">;
326
327defm script: Eq<"script", "Read linker script">;
328
329defm section_start: Eq<"section-start", "Set address of section">,
330  MetaVarName<"<address>">;
331
332def shared: F<"shared">, HelpText<"Build a shared object">;
333
334defm soname: Eq<"soname", "Set DT_SONAME">;
335
336defm sort_section:
337  Eq<"sort-section", "Specifies sections sorting rule when linkerscript is used">;
338
339def start_group: F<"start-group">,
340  HelpText<"Ignored for compatibility with GNU unless you pass --warn-backrefs">;
341
342def start_lib: F<"start-lib">,
343  HelpText<"Start a grouping of objects that should be treated as if they were together in an archive">;
344
345def strip_all: F<"strip-all">, HelpText<"Strip all symbols">;
346
347def strip_debug: F<"strip-debug">, HelpText<"Strip debugging information">;
348
349defm symbol_ordering_file:
350  Eq<"symbol-ordering-file", "Layout sections to place symbols in the order specified by symbol ordering file">;
351
352defm sysroot: Eq<"sysroot", "Set the system root">;
353
354def target1_rel: F<"target1-rel">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_REL32">;
355
356def target1_abs: F<"target1-abs">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_ABS32 (default)">;
357
358defm target2:
359  Eq<"target2", "Interpret R_ARM_TARGET2 as <type>, where <type> is one of rel, abs, or got-rel">,
360  MetaVarName<"<type>">;
361
362defm threads
363    : Eq<"threads",
364         "Number of threads. '1' disables multi-threading. By default all "
365         "available hardware threads are used">;
366
367def time_trace: F<"time-trace">, HelpText<"Record time trace">;
368def time_trace_file_eq: J<"time-trace-file=">, HelpText<"Specify time trace output file">;
369
370defm time_trace_granularity: Eq<"time-trace-granularity",
371  "Minimum time granularity (in microseconds) traced by time profiler">;
372
373defm toc_optimize : B<"toc-optimize",
374    "(PowerPC64) Enable TOC related optimizations (default)",
375    "(PowerPC64) Disable TOC related optimizations">;
376
377def trace: F<"trace">, HelpText<"Print the names of the input files">;
378
379defm trace_symbol: Eq<"trace-symbol", "Trace references to symbols">;
380
381defm undefined: Eq<"undefined", "Force undefined symbol during linking">,
382  MetaVarName<"<symbol>">;
383
384defm undefined_glob: Eq<"undefined-glob", "Force undefined symbol during linking">,
385  MetaVarName<"<pattern>">;
386
387def unique: F<"unique">, HelpText<"Creates a separate output section for every orphan input section">;
388
389defm unresolved_symbols:
390  Eq<"unresolved-symbols", "Determine how to handle unresolved symbols">;
391
392defm undefined_version: B<"undefined-version",
393  "Allow unused version in version script (default)",
394  "Report version scripts that refer undefined symbols">;
395
396defm rsp_quoting: Eq<"rsp-quoting", "Quoting style for response files">,
397  MetaVarName<"[posix,windows]">;
398
399def v: Flag<["-"], "v">, HelpText<"Display the version number">;
400
401def verbose: F<"verbose">, HelpText<"Verbose mode">;
402
403def version: F<"version">, HelpText<"Display the version number and exit">;
404
405defm version_script: Eq<"version-script", "Read a version script">;
406
407defm warn_backrefs: B<"warn-backrefs",
408    "Warn about backward symbol references to fetch archive members",
409    "Do not warn about backward symbol references to fetch archive members (default)">;
410
411defm warn_backrefs_exclude
412    : Eq<"warn-backrefs-exclude",
413         "Glob describing an archive (or an object file within --start-lib) "
414         "which should be ignored for --warn-backrefs.">,
415      MetaVarName<"<glob>">;
416
417defm warn_common: B<"warn-common",
418    "Warn about duplicate common symbols",
419    "Do not warn about duplicate common symbols (default)">;
420
421defm warn_ifunc_textrel: B<"warn-ifunc-textrel",
422    "Warn about using ifunc symbols with text relocations",
423    "Do not warn about using ifunc symbols with text relocations (default)">;
424
425defm warn_symbol_ordering: B<"warn-symbol-ordering",
426    "Warn about problems with the symbol ordering file (default)",
427    "Do not warn about problems with the symbol ordering file">;
428
429def warn_unresolved_symbols: F<"warn-unresolved-symbols">,
430  HelpText<"Report unresolved symbols as warnings">;
431
432defm whole_archive: B<"whole-archive",
433    "Force load of all members in a static library",
434    "Do not force load of all members in a static library (default)">;
435
436defm wrap: Eq<"wrap", "Use wrapper functions for symbol">,
437  MetaVarName<"<symbol>=<symbol>">;
438
439def z: JoinedOrSeparate<["-"], "z">, MetaVarName<"<option>">,
440  HelpText<"Linker option extensions">;
441
442def visual_studio_diagnostics_format : F<"vs-diagnostics">,
443HelpText<"Format diagnostics for Visual Studio compatibility">;
444
445// Aliases
446def: Separate<["-"], "f">, Alias<auxiliary>, HelpText<"Alias for --auxiliary">;
447def: F<"call_shared">, Alias<Bdynamic>, HelpText<"Alias for --Bdynamic">;
448def: F<"dy">, Alias<Bdynamic>, HelpText<"Alias for --Bdynamic">;
449def: F<"dn">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">;
450def: F<"non_shared">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">;
451def: F<"static">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">;
452def: Flag<["-"], "d">, Alias<define_common>, HelpText<"Alias for --define-common">;
453def: F<"dc">, Alias<define_common>, HelpText<"Alias for --define-common">;
454def: F<"dp">, Alias<define_common>, HelpText<"Alias for --define-common">;
455def: Flag<["-"], "x">, Alias<discard_all>, HelpText<"Alias for --discard-all">;
456def: Flag<["-"], "X">, Alias<discard_locals>, HelpText<"Alias for --discard-locals">;
457def: Flag<["-"], "q">, Alias<emit_relocs>, HelpText<"Alias for --emit-relocs">;
458def: Flag<["-"], ")">, Alias<end_group>, HelpText<"Alias for --end-group">;
459def: JoinedOrSeparate<["-"], "e">, Alias<entry>, HelpText<"Alias for --entry">;
460def: Flag<["-"], "E">, Alias<export_dynamic>, HelpText<"Alias for --export-dynamic">;
461def: Separate<["-"], "F">, Alias<filter>, HelpText<"Alias for --filter">;
462def: Separate<["-"], "b">, Alias<format>, HelpText<"Alias for --format">;
463def: JoinedOrSeparate<["-"], "l">, Alias<library>, HelpText<"Alias for --library">;
464def: JoinedOrSeparate<["-"], "L">, Alias<library_path>, HelpText<"Alias for --library-path">;
465def: F<"no-pic-executable">, Alias<no_pie>, HelpText<"Alias for --no-pie">;
466def: Flag<["-"], "n">, Alias<nmagic>, HelpText<"Alias for --nmagic">;
467def: Flag<["-"], "N">, Alias<omagic>, HelpText<"Alias for --omagic">;
468def: Joined<["--"], "output=">, Alias<o>, HelpText<"Alias for -o">;
469def: Separate<["--"], "output">, Alias<o>, HelpText<"Alias for -o">;
470def: F<"pic-executable">, Alias<pie>, HelpText<"Alias for --pie">;
471def: Flag<["-"], "M">, Alias<print_map>, HelpText<"Alias for --print-map">;
472def: Flag<["-"], "r">, Alias<relocatable>, HelpText<"Alias for --relocatable">;
473def: JoinedOrSeparate<["-"], "R">, Alias<rpath>, HelpText<"Alias for --rpath">;
474def: JoinedOrSeparate<["-"], "T">, Alias<script>, HelpText<"Alias for --script">;
475def: F<"Bshareable">, Alias<shared>, HelpText<"Alias for --shared">;
476def: JoinedOrSeparate<["-"], "h">, Alias<soname>, HelpText<"Alias for --soname">;
477def: Flag<["-"], "(">, Alias<start_group>, HelpText<"Alias for --start-group">;
478def: Flag<["-"], "s">, Alias<strip_all>, HelpText<"Alias for --strip-all">;
479def: Flag<["-"], "S">, Alias<strip_debug>, HelpText<"Alias for --strip-debug">;
480def: Flag<["-"], "t">, Alias<trace>, HelpText<"Alias for --trace">;
481def: Joined<["-", "--"], "Ttext-segment=">, Alias<Ttext_segment>;
482def: JoinedOrSeparate<["-"], "y">, Alias<trace_symbol>, HelpText<"Alias for --trace-symbol">;
483def: JoinedOrSeparate<["-"], "u">, Alias<undefined>, HelpText<"Alias for --undefined">;
484def: Flag<["-"], "V">, Alias<version>, HelpText<"Alias for --version">;
485
486// LTO-related options.
487def lto_aa_pipeline: J<"lto-aa-pipeline=">,
488  HelpText<"AA pipeline to run during LTO. Used in conjunction with -lto-newpm-passes">;
489def lto_debug_pass_manager: F<"lto-debug-pass-manager">,
490  HelpText<"Debug new pass manager">;
491def lto_emit_asm: F<"lto-emit-asm">,
492  HelpText<"Emit assembly code">;
493def lto_new_pass_manager: F<"lto-new-pass-manager">,
494  HelpText<"Use new pass manager">;
495def lto_newpm_passes: J<"lto-newpm-passes=">,
496  HelpText<"Passes to run during LTO">;
497def lto_O: J<"lto-O">, MetaVarName<"<opt-level>">,
498  HelpText<"Optimization level for LTO">;
499def lto_partitions: J<"lto-partitions=">,
500  HelpText<"Number of LTO codegen partitions">;
501def lto_cs_profile_generate: F<"lto-cs-profile-generate">,
502  HelpText<"Perform context sensitive PGO instrumentation">;
503def lto_cs_profile_file: J<"lto-cs-profile-file=">,
504  HelpText<"Context sensitive profile file path">;
505def lto_obj_path_eq: J<"lto-obj-path=">;
506def lto_sample_profile: J<"lto-sample-profile=">,
507  HelpText<"Sample profile file path">;
508def lto_whole_program_visibility: F<"lto-whole-program-visibility">,
509  HelpText<"Asserts that the LTO link has whole program visibility">;
510def disable_verify: F<"disable-verify">;
511defm mllvm: Eq<"mllvm", "Additional arguments to forward to LLVM's option processing">;
512def opt_remarks_filename: Separate<["--"], "opt-remarks-filename">,
513  HelpText<"YAML output file for optimization remarks">;
514def opt_remarks_passes: Separate<["--"], "opt-remarks-passes">,
515  HelpText<"Regex for the passes that need to be serialized to the output file">;
516def opt_remarks_with_hotness: Flag<["--"], "opt-remarks-with-hotness">,
517  HelpText<"Include hotness information in the optimization remarks file">;
518def opt_remarks_format: Separate<["--"], "opt-remarks-format">,
519  HelpText<"The format used for serializing remarks (default: YAML)">;
520def save_temps: F<"save-temps">;
521def lto_basicblock_sections: J<"lto-basicblock-sections=">,
522  HelpText<"Enable basic block sections for LTO">;
523defm lto_unique_bb_section_names: B<"lto-unique-bb-section-names",
524    "Give unique names to every basic block section for LTO",
525    "Do not give unique names to every basic block section for LTO (default)">;
526def shuffle_sections: J<"shuffle-sections=">, MetaVarName<"<seed>">,
527  HelpText<"Shuffle input sections using the given seed. If 0, use a random seed">;
528def thinlto_cache_dir: J<"thinlto-cache-dir=">,
529  HelpText<"Path to ThinLTO cached object file directory">;
530defm thinlto_cache_policy: Eq<"thinlto-cache-policy", "Pruning policy for the ThinLTO cache">;
531def thinlto_emit_imports_files: F<"thinlto-emit-imports-files">;
532def thinlto_index_only: F<"thinlto-index-only">;
533def thinlto_index_only_eq: J<"thinlto-index-only=">;
534def thinlto_jobs: J<"thinlto-jobs=">,
535  HelpText<"Number of ThinLTO jobs. Default to --threads=">;
536def thinlto_object_suffix_replace_eq: J<"thinlto-object-suffix-replace=">;
537def thinlto_prefix_replace_eq: J<"thinlto-prefix-replace=">;
538
539def: J<"plugin-opt=O">, Alias<lto_O>, HelpText<"Alias for --lto-O">;
540def: F<"plugin-opt=debug-pass-manager">,
541  Alias<lto_debug_pass_manager>, HelpText<"Alias for --lto-debug-pass-manager">;
542def: F<"plugin-opt=disable-verify">, Alias<disable_verify>, HelpText<"Alias for --disable-verify">;
543def plugin_opt_dwo_dir_eq: J<"plugin-opt=dwo_dir=">,
544  HelpText<"Directory to store .dwo files when LTO and debug fission are used">;
545def plugin_opt_emit_asm: F<"plugin-opt=emit-asm">,
546  Alias<lto_emit_asm>, HelpText<"Alias for --lto-emit-asm">;
547def plugin_opt_emit_llvm: F<"plugin-opt=emit-llvm">;
548def: J<"plugin-opt=jobs=">, Alias<thinlto_jobs>, HelpText<"Alias for --thinlto-jobs">;
549def: J<"plugin-opt=lto-partitions=">, Alias<lto_partitions>, HelpText<"Alias for --lto-partitions">;
550def plugin_opt_mcpu_eq: J<"plugin-opt=mcpu=">;
551def: F<"plugin-opt=new-pass-manager">,
552  Alias<lto_new_pass_manager>, HelpText<"Alias for --lto-new-pass-manager">;
553def: F<"plugin-opt=cs-profile-generate">,
554  Alias<lto_cs_profile_generate>, HelpText<"Alias for --lto-cs-profile-generate">;
555def: J<"plugin-opt=cs-profile-path=">,
556  Alias<lto_cs_profile_file>, HelpText<"Alias for --lto-cs-profile-file">;
557def: J<"plugin-opt=obj-path=">,
558  Alias<lto_obj_path_eq>,
559  HelpText<"Alias for --lto-obj-path=">;
560def: J<"plugin-opt=sample-profile=">,
561  Alias<lto_sample_profile>, HelpText<"Alias for --lto-sample-profile">;
562def: F<"plugin-opt=save-temps">, Alias<save_temps>, HelpText<"Alias for --save-temps">;
563def: F<"plugin-opt=thinlto-emit-imports-files">,
564  Alias<thinlto_emit_imports_files>,
565  HelpText<"Alias for --thinlto-emit-imports-files">;
566def: F<"plugin-opt=thinlto-index-only">,
567  Alias<thinlto_index_only>,
568  HelpText<"Alias for --thinlto-index-only">;
569def: J<"plugin-opt=thinlto-index-only=">,
570  Alias<thinlto_index_only_eq>,
571  HelpText<"Alias for --thinlto-index-only=">;
572def: J<"plugin-opt=thinlto-object-suffix-replace=">,
573 Alias<thinlto_object_suffix_replace_eq>,
574 HelpText<"Alias for --thinlto-object-suffix-replace=">;
575def: J<"plugin-opt=thinlto-prefix-replace=">,
576  Alias<thinlto_prefix_replace_eq>,
577  HelpText<"Alias for --thinlto-prefix-replace=">;
578
579// Ignore LTO plugin-related options.
580// clang -flto passes -plugin and -plugin-opt to the linker. This is required
581// for ld.gold and ld.bfd to get LTO working. But it's not for lld which doesn't
582// rely on a plugin. Instead of detecting which linker is used on clang side we
583// just ignore the option on lld side as it's easier. In fact, the linker could
584// be called 'ld' and understanding which linker is used would require parsing of
585// --version output.
586defm plugin: Eq<"plugin", "Ignored for compatibility with GNU linkers">;
587
588def plugin_opt_eq_minus: J<"plugin-opt=-">,
589  HelpText<"Specify an LLVM option for compatibility with LLVMgold.so">;
590def: J<"plugin-opt=thinlto">;
591
592// Ignore GCC collect2 LTO plugin related options. Note that we don't support
593// GCC LTO, but GCC collect2 passes these options even in non-LTO mode.
594def: J<"plugin-opt=-fresolution=">;
595def: J<"plugin-opt=-pass-through=">;
596// This may be either an unhandled LLVMgold.so feature or GCC passed
597// -plugin-opt=path/to/{liblto_plugin.so,lto-wrapper}
598def plugin_opt_eq : J<"plugin-opt=">;
599
600// Options listed below are silently ignored for now for compatibility.
601def: F<"detect-odr-violations">;
602def: Flag<["-"], "g">;
603def: F<"long-plt">;
604def: F<"no-add-needed">;
605def: F<"no-copy-dt-needed-entries">;
606def: F<"no-ctors-in-init-array">;
607def: F<"no-keep-memory">;
608def: F<"no-pipeline-knowledge">;
609def: F<"no-warn-mismatch">;
610def: Flag<["-"], "p">;
611def: Separate<["--", "-"], "rpath-link">;
612def: J<"rpath-link=">;
613def: F<"secure-plt">;
614def: F<"sort-common">;
615def: F<"stats">;
616def: F<"warn-execstack">;
617def: F<"warn-once">;
618def: F<"warn-shared-textrel">;
619def: F<"EB">;
620def: F<"EL">;
621def: JoinedOrSeparate<["-"], "G">;
622def: F<"Qy">;
623
624// Hidden option used for testing MIPS multi-GOT implementation.
625defm mips_got_size:
626  Eq<"mips-got-size", "Max size of a single MIPS GOT. 0x10000 by default.">,
627  Flags<[HelpHidden]>;
628