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