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