]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lld/ELF/Options.td
Upgrade to OpenSSH 7.8p1.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lld / ELF / Options.td
1 include "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'.
5 class F<string name>: Flag<["--", "-"], name>;
6 class J<string name>: Joined<["--", "-"], name>;
7 class S<string name>: Separate<["--", "-"], name>;
8
9 multiclass Eq<string name> {
10   def "": Separate<["--", "-"], name>;
11   def _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>;
12 }
13
14 def auxiliary: S<"auxiliary">, HelpText<"Set DT_AUXILIARY field to the specified name">;
15
16 def Bsymbolic: F<"Bsymbolic">, HelpText<"Bind defined symbols locally">;
17
18 def Bsymbolic_functions: F<"Bsymbolic-functions">,
19   HelpText<"Bind defined function symbols locally">;
20
21 def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">;
22
23 def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">;
24
25 def build_id: F<"build-id">, HelpText<"Generate build ID note">;
26
27 def build_id_eq: J<"build-id=">, HelpText<"Generate build ID note">;
28
29 defm compress_debug_sections : Eq<"compress-debug-sections">,
30   HelpText<"Compress DWARF debug sections">;
31
32 defm defsym: Eq<"defsym">, HelpText<"Define a symbol alias">;
33
34 defm library_path: Eq<"library-path">,
35   HelpText<"Add a directory to the library search path">, MetaVarName<"<dir>">;
36
37 def O: JoinedOrSeparate<["-"], "O">, HelpText<"Optimize output file size">;
38
39 defm Tbss: Eq<"Tbss">,
40   HelpText<"Same as --section-start with .bss as the sectionname">;
41
42 defm Tdata: Eq<"Tdata">,
43   HelpText<"Same as --section-start with .data as the sectionname">;
44
45 defm Ttext: Eq<"Ttext">,
46   HelpText<"Same as --section-start with .text as the sectionname">;
47
48 def allow_multiple_definition: F<"allow-multiple-definition">,
49   HelpText<"Allow multiple definitions">;
50
51 def as_needed: F<"as-needed">,
52   HelpText<"Only set DT_NEEDED for shared libraries if used">;
53
54 // -chroot doesn't have a help text because it is an internal option.
55 def chroot: S<"chroot">;
56
57 def color_diagnostics: F<"color-diagnostics">,
58   HelpText<"Use colors in diagnostics">;
59
60 def color_diagnostics_eq: J<"color-diagnostics=">,
61   HelpText<"Use colors in diagnostics">;
62
63 def define_common: F<"define-common">,
64   HelpText<"Assign space to common symbols">;
65
66 def demangle: F<"demangle">, HelpText<"Demangle symbol names">;
67
68 def disable_new_dtags: F<"disable-new-dtags">,
69   HelpText<"Disable new dynamic tags">;
70
71 def discard_all: F<"discard-all">, HelpText<"Delete all local symbols">;
72
73 def discard_locals: F<"discard-locals">,
74   HelpText<"Delete temporary local symbols">;
75
76 def discard_none: F<"discard-none">,
77   HelpText<"Keep all symbols in the symbol table">;
78
79 def dynamic_linker: S<"dynamic-linker">,
80   HelpText<"Which dynamic linker to use">;
81
82 defm dynamic_list: Eq<"dynamic-list">,
83   HelpText<"Read a list of dynamic symbols">;
84
85 def eh_frame_hdr: F<"eh-frame-hdr">,
86   HelpText<"Request creation of .eh_frame_hdr section and PT_GNU_EH_FRAME segment header">;
87
88 def emit_relocs: F<"emit-relocs">, HelpText<"Generate relocations in output">;
89
90 def enable_new_dtags: F<"enable-new-dtags">,
91   HelpText<"Enable new dynamic tags">;
92
93 def end_lib: F<"end-lib">,
94   HelpText<"End a grouping of objects that should be treated as if they were together in an archive">;
95
96 defm entry: Eq<"entry">, HelpText<"Name of entry point symbol">,
97   MetaVarName<"<entry>">;
98
99 defm error_limit: Eq<"error-limit">,
100   HelpText<"Maximum number of errors to emit before stopping (0 = no limit)">;
101
102 def error_unresolved_symbols: F<"error-unresolved-symbols">,
103   HelpText<"Report unresolved symbols as errors">;
104
105 defm exclude_libs: Eq<"exclude-libs">,
106   HelpText<"Exclude static libraries from automatic export">;
107
108 def export_dynamic: F<"export-dynamic">,
109   HelpText<"Put symbols in the dynamic symbol table">;
110
111 defm export_dynamic_symbol: Eq<"export-dynamic-symbol">,
112   HelpText<"Put a symbol in the dynamic symbol table">;
113
114 def fatal_warnings: F<"fatal-warnings">,
115   HelpText<"Treat warnings as errors">;
116
117 defm filter: Eq<"filter">,
118   HelpText<"Set DT_FILTER field to the specified name">;
119
120 defm fini: Eq<"fini">,
121   HelpText<"Specify a finalizer function">, MetaVarName<"<symbol>">;
122
123 def fix_cortex_a53_843419: F<"fix-cortex-a53-843419">,
124   HelpText<"Apply fixes for AArch64 Cortex-A53 erratum 843419">;
125
126 def full_shutdown : F<"full-shutdown">,
127   HelpText<"Perform a full shutdown instead of calling _exit">;
128
129 defm format: Eq<"format">,
130   HelpText<"Change the input format of the inputs following this option">,
131   MetaVarName<"<input-format>">;
132
133 def gc_sections: F<"gc-sections">,
134   HelpText<"Enable garbage collection of unused sections">;
135
136 def gdb_index: F<"gdb-index">,
137   HelpText<"Generate .gdb_index section">;
138
139 defm hash_style: Eq<"hash-style">,
140   HelpText<"Specify hash style (sysv, gnu or both)">;
141
142 def help: F<"help">, HelpText<"Print option help">;
143
144 def icf_all: F<"icf=all">, HelpText<"Enable identical code folding">;
145
146 def icf_data: F<"icf-data">,
147   HelpText<"Enable ICF to also fold identical read only data">;
148
149 def icf_none: F<"icf=none">, HelpText<"Disable identical code folding">;
150
151 defm image_base : Eq<"image-base">, HelpText<"Set the base address">;
152
153 defm init: Eq<"init">, HelpText<"Specify an initializer function">,
154   MetaVarName<"<symbol>">;
155
156 defm library: Eq<"library">, HelpText<"Root name of library to use">,
157   MetaVarName<"<libName>">;
158
159 def lto_O: J<"lto-O">, MetaVarName<"<opt-level>">,
160   HelpText<"Optimization level for LTO">;
161
162 def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;
163
164 defm Map: Eq<"Map">, HelpText<"Print a link map to the specified file">;
165
166 def merge_exidx_entries: F<"merge-exidx-entries">,
167   HelpText<"Enable merging .ARM.exidx entries">;
168
169 def nostdlib: F<"nostdlib">,
170   HelpText<"Only search directories specified on the command line">;
171
172 def no_as_needed: F<"no-as-needed">,
173   HelpText<"Always DT_NEEDED for shared libraries">;
174
175 def no_color_diagnostics: F<"no-color-diagnostics">,
176   HelpText<"Do not use colors in diagnostics">;
177
178 def no_define_common: F<"no-define-common">,
179   HelpText<"Do not assign space to common symbols">;
180
181 def no_demangle: F<"no-demangle">,
182   HelpText<"Do not demangle symbol names">;
183
184 def no_dynamic_linker: F<"no-dynamic-linker">,
185   HelpText<"Inhibit output of .interp section">;
186
187 def no_eh_frame_hdr: F<"no-eh-frame-hdr">,
188   HelpText<"Do not create .eh_frame_hdr section">;
189
190 def no_export_dynamic: F<"no-export-dynamic">;
191 def no_fatal_warnings: F<"no-fatal-warnings">;
192
193 def no_gc_sections: F<"no-gc-sections">,
194   HelpText<"Disable garbage collection of unused sections">;
195
196 def no_gdb_index: F<"no-gdb-index">,
197   HelpText<"Do not generate .gdb_index section">;
198
199 def no_gnu_unique: F<"no-gnu-unique">,
200   HelpText<"Disable STB_GNU_UNIQUE symbol binding">;
201
202 def no_merge_exidx_entries: F<"no-merge-exidx-entries">,
203   HelpText<"Disable merging .ARM.exidx entries">;
204
205 def no_threads: F<"no-threads">,
206   HelpText<"Do not run the linker multi-threaded">;
207
208 def no_whole_archive: F<"no-whole-archive">,
209   HelpText<"Restores the default behavior of loading archive members">;
210
211 def noinhibit_exec: F<"noinhibit-exec">,
212   HelpText<"Retain the executable output file whenever it is still usable">;
213
214 def nopie: F<"nopie">, HelpText<"Do not create a position independent executable">;
215
216 def no_omagic: Flag<["--"], "no-omagic">, MetaVarName<"<magic>">,
217   HelpText<"Do not set the text data sections to be writable">;
218
219 def no_print_gc_sections: F<"no-print-gc-sections">,
220   HelpText<"Do not list removed unused sections">;
221
222 def no_rosegment: F<"no-rosegment">,
223   HelpText<"Do not put read-only non-executable sections in their own segment">;
224
225 def no_undefined: F<"no-undefined">,
226   HelpText<"Report unresolved symbols even if the linker is creating a shared library">;
227
228 def no_undefined_version: F<"no-undefined-version">,
229   HelpText<"Report version scripts that refer undefined symbols">;
230
231 def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
232   HelpText<"Path to file to write output">;
233
234 def oformat: Separate<["--"], "oformat">, MetaVarName<"<format>">,
235   HelpText<"Specify the binary format for the output object file">;
236
237 def omagic: Flag<["--"], "omagic">, MetaVarName<"<magic>">,
238   HelpText<"Set the text and data sections to be readable and writable">;
239
240 defm orphan_handling: Eq<"orphan-handling">,
241   HelpText<"Control how orphan sections are handled when linker script used">;
242
243 def pack_dyn_relocs_eq: J<"pack-dyn-relocs=">, MetaVarName<"<format>">,
244   HelpText<"Pack dynamic relocations in the given format (none or android)">;
245
246 def pie: F<"pie">, HelpText<"Create a position independent executable">;
247
248 def print_gc_sections: F<"print-gc-sections">,
249   HelpText<"List removed unused sections">;
250
251 def print_map: F<"print-map">,
252   HelpText<"Print a link map to the standard output">;
253
254 defm reproduce: Eq<"reproduce">,
255   HelpText<"Dump linker invocation and input files for debugging">;
256
257 defm rpath: Eq<"rpath">, HelpText<"Add a DT_RUNPATH to the output">;
258
259 def relocatable: F<"relocatable">, HelpText<"Create relocatable object file">;
260
261 defm retain_symbols_file: Eq<"retain-symbols-file">,
262   HelpText<"Retain only the symbols listed in the file">,
263   MetaVarName<"<file>">;
264
265 defm script: Eq<"script">, HelpText<"Read linker script">;
266
267 def section_start: S<"section-start">, MetaVarName<"<address>">,
268   HelpText<"Set address of section">;
269
270 def shared: F<"shared">, HelpText<"Build a shared object">;
271
272 defm soname: Eq<"soname">, HelpText<"Set DT_SONAME">;
273
274 defm sort_section: Eq<"sort-section">,
275   HelpText<"Specifies sections sorting rule when linkerscript is used">;
276
277 def start_lib: F<"start-lib">,
278   HelpText<"Start a grouping of objects that should be treated as if they were together in an archive">;
279
280 def strip_all: F<"strip-all">, HelpText<"Strip all symbols">;
281
282 def strip_debug: F<"strip-debug">, HelpText<"Strip debugging information">;
283
284 def symbol_ordering_file: S<"symbol-ordering-file">,
285   HelpText<"Layout sections in the order specified by symbol file">;
286
287 defm sysroot: Eq<"sysroot">, HelpText<"Set the system root">;
288
289 def target1_rel: F<"target1-rel">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_REL32">;
290
291 def target1_abs: F<"target1-abs">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_ABS32">;
292
293 defm target2: Eq<"target2">,
294   HelpText<"Interpret R_ARM_TARGET2 as <type>, where <type> is one of rel, abs, or got-rel">,
295   MetaVarName<"<type>">;
296
297 def threads: F<"threads">, HelpText<"Run the linker multi-threaded">;
298
299 def trace: F<"trace">, HelpText<"Print the names of the input files">;
300
301 defm trace_symbol : Eq<"trace-symbol">, HelpText<"Trace references to symbols">;
302
303 defm undefined: Eq<"undefined">,
304   HelpText<"Force undefined symbol during linking">;
305
306 defm unresolved_symbols: Eq<"unresolved-symbols">,
307   HelpText<"Determine how to handle unresolved symbols">;
308
309 defm rsp_quoting: Eq<"rsp-quoting">,
310   HelpText<"Quoting style for response files. Values supported: windows|posix">;
311
312 def v: Flag<["-"], "v">, HelpText<"Display the version number">;
313
314 def verbose: F<"verbose">, HelpText<"Verbose mode">;
315
316 def version: F<"version">, HelpText<"Display the version number and exit">;
317
318 defm version_script: Eq<"version-script">, HelpText<"Read a version script">;
319
320 def warn_common: F<"warn-common">,
321   HelpText<"Warn about duplicate common symbols">;
322
323 def warn_unresolved_symbols: F<"warn-unresolved-symbols">,
324   HelpText<"Report unresolved symbols as warnings">;
325
326 def whole_archive: F<"whole-archive">,
327   HelpText<"Force load of all members in a static library">;
328
329 defm wrap: Eq<"wrap">, HelpText<"Use wrapper functions for symbol">,
330   MetaVarName<"<symbol>">;
331
332 def z: JoinedOrSeparate<["-"], "z">, MetaVarName<"<option>">,
333   HelpText<"Linker option extensions">;
334
335 // Aliases
336 def alias_auxiliary: Separate<["-"], "f">, Alias<auxiliary>;
337 def alias_Bdynamic_call_shared: F<"call_shared">, Alias<Bdynamic>;
338 def alias_Bdynamic_dy: F<"dy">, Alias<Bdynamic>;
339 def alias_Bstatic_dn: F<"dn">, Alias<Bstatic>;
340 def alias_Bstatic_non_shared: F<"non_shared">, Alias<Bstatic>;
341 def alias_Bstatic_static: F<"static">, Alias<Bstatic>;
342 def alias_define_common_d: Flag<["-"], "d">, Alias<define_common>;
343 def alias_define_common_dc: F<"dc">, Alias<define_common>;
344 def alias_define_common_dp: F<"dp">, Alias<define_common>;
345 def alias_discard_all_x: Flag<["-"], "x">, Alias<discard_all>;
346 def alias_discard_locals_X: Flag<["-"], "X">, Alias<discard_locals>;
347 def alias_emit_relocs: Flag<["-"], "q">, Alias<emit_relocs>;
348 def alias_entry_e: JoinedOrSeparate<["-"], "e">, Alias<entry>;
349 def alias_export_dynamic_E: Flag<["-"], "E">, Alias<export_dynamic>;
350 def alias_filter: Separate<["-"], "F">, Alias<filter>;
351 def alias_format_b: S<"b">, Alias<format>;
352 def alias_library: JoinedOrSeparate<["-"], "l">, Alias<library>;
353 def alias_library_path: JoinedOrSeparate<["-"], "L">, Alias<library_path>;
354 def alias_omagic: Flag<["-"], "N">, Alias<omagic>;
355 def alias_o_output: Joined<["--"], "output=">, Alias<o>;
356 def alias_o_output2 : Separate<["--"], "output">, Alias<o>;
357 def alias_pie_pic_executable: F<"pic-executable">, Alias<pie>;
358 def alias_print_map_M: Flag<["-"], "M">, Alias<print_map>;
359 def alias_relocatable_r: Flag<["-"], "r">, Alias<relocatable>;
360 def alias_rpath_R: JoinedOrSeparate<["-"], "R">, Alias<rpath>;
361 def alias_script_T: JoinedOrSeparate<["-"], "T">, Alias<script>;
362 def alias_shared_Bshareable: F<"Bshareable">, Alias<shared>;
363 def alias_soname_h: JoinedOrSeparate<["-"], "h">, Alias<soname>;
364 def alias_strip_all: Flag<["-"], "s">, Alias<strip_all>;
365 def alias_strip_debug_S: Flag<["-"], "S">, Alias<strip_debug>;
366 def alias_trace: Flag<["-"], "t">, Alias<trace>;
367 def alias_trace_symbol_y : JoinedOrSeparate<["-"], "y">, Alias<trace_symbol>;
368 def alias_Ttext_segment: S<"Ttext-segment">, Alias<Ttext>;
369 def alias_Ttext_segment_eq: J<"Ttext-segment=">, Alias<Ttext>;
370 def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>;
371 def alias_version_V: Flag<["-"], "V">, Alias<version>;
372
373 // Our symbol resolution algorithm handles symbols in archive files differently
374 // than traditional linkers, so we don't need --start-group and --end-group.
375 // These options are recongized for compatibility but ignored.
376 def end_group: F<"end-group">;
377 def end_group_paren: Flag<["-"], ")">;
378 def start_group: F<"start-group">;
379 def start_group_paren: Flag<["-"], "(">;
380
381 // LTO-related options.
382 def lto_aa_pipeline: J<"lto-aa-pipeline=">,
383   HelpText<"AA pipeline to run during LTO. Used in conjunction with -lto-newpm-passes">;
384 def lto_newpm_passes: J<"lto-newpm-passes=">,
385   HelpText<"Passes to run during LTO">;
386 def lto_partitions: J<"lto-partitions=">,
387   HelpText<"Number of LTO codegen partitions">;
388 def disable_verify: F<"disable-verify">;
389 def mllvm: S<"mllvm">;
390 def opt_remarks_filename: Separate<["--"], "opt-remarks-filename">,
391   HelpText<"YAML output file for optimization remarks">;
392 def opt_remarks_with_hotness: Flag<["--"], "opt-remarks-with-hotness">,
393   HelpText<"Include hotness informations in the optimization remarks file">;
394 defm plugin_opt: Eq<"plugin-opt">,
395   HelpText<"specifies LTO options for compatibility with GNU linkers">;
396 def save_temps: F<"save-temps">;
397 def thinlto_cache_dir: J<"thinlto-cache-dir=">,
398   HelpText<"Path to ThinLTO cached object file directory">;
399 def thinlto_cache_policy: S<"thinlto-cache-policy">,
400   HelpText<"Pruning policy for the ThinLTO cache">;
401 def thinlto_jobs: J<"thinlto-jobs=">, HelpText<"Number of ThinLTO jobs">;
402
403 // Ignore LTO plugin-related options.
404 // clang -flto passes -plugin and -plugin-opt to the linker. This is required
405 // for ld.gold and ld.bfd to get LTO working. But it's not for lld which doesn't
406 // rely on a plugin. Instead of detecting which linker is used on clang side we
407 // just ignore the option on lld side as it's easier. In fact, the linker could
408 // be called 'ld' and understanding which linker is used would require parsing of
409 // --version output.
410 def plugin: S<"plugin">;
411 def plugin_eq: J<"plugin=">;
412
413 // Options listed below are silently ignored for now for compatibility.
414 def allow_shlib_undefined: F<"allow-shlib-undefined">;
415 def cref: F<"cref">;
416 def detect_odr_violations: F<"detect-odr-violations">;
417 def g: Flag<["-"], "g">;
418 def long_plt: F<"long-plt">;
419 def no_add_needed: F<"no-add-needed">;
420 def no_allow_shlib_undefined: F<"no-allow-shlib-undefined">;
421 def no_copy_dt_needed_entries: F<"no-copy-dt-needed-entries">;
422 def no_ctors_in_init_array: F<"no-ctors-in-init-array">;
423 def no_keep_memory: F<"no-keep-memory">;
424 def no_mmap_output_file: F<"no-mmap-output-file">;
425 def no_warn_common: F<"no-warn-common">;
426 def no_warn_mismatch: F<"no-warn-mismatch">;
427 def rpath_link: S<"rpath-link">;
428 def rpath_link_eq: J<"rpath-link=">;
429 def sort_common: F<"sort-common">;
430 def stats: F<"stats">;
431 def warn_execstack: F<"warn-execstack">;
432 def warn_once: F<"warn-once">;
433 def warn_shared_textrel: F<"warn-shared-textrel">;
434 def EB : F<"EB">;
435 def EL : F<"EL">;
436 def G: JoinedOrSeparate<["-"], "G">;
437 def Qy : F<"Qy">;