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