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