]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lld/ELF/Options.td
Bring lld (release_39 branch, r279477) to contrib
[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 Bsymbolic: F<"Bsymbolic">, HelpText<"Bind defined symbols locally">;
11
12 def Bsymbolic_functions: F<"Bsymbolic-functions">,
13   HelpText<"Bind defined function symbols locally">;
14
15 def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">;
16
17 def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">;
18
19 def build_id: F<"build-id">, HelpText<"Generate build ID note">;
20
21 def build_id_eq: J<"build-id=">, HelpText<"Generate build ID note">;
22
23 def L: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">,
24   HelpText<"Add a directory to the library search path">;
25
26 def O: Joined<["-"], "O">, HelpText<"Optimize output file size">;
27
28 def allow_multiple_definition: F<"allow-multiple-definition">,
29   HelpText<"Allow multiple definitions">;
30
31 def as_needed: F<"as-needed">,
32   HelpText<"Only set DT_NEEDED for shared libraries if used">;
33
34 def disable_new_dtags: F<"disable-new-dtags">,
35   HelpText<"Disable new dynamic tags">;
36
37 def discard_all: F<"discard-all">, HelpText<"Delete all local symbols">;
38
39 def discard_locals: F<"discard-locals">,
40   HelpText<"Delete temporary local symbols">;
41
42 def discard_none: F<"discard-none">,
43   HelpText<"Keep all symbols in the symbol table">;
44
45 def dynamic_linker: S<"dynamic-linker">,
46   HelpText<"Which dynamic linker to use">;
47
48 def dynamic_list: S<"dynamic-list">,
49   HelpText<"Read a list of dynamic symbols">;
50
51 def eh_frame_hdr: F<"eh-frame-hdr">,
52   HelpText<"Request creation of .eh_frame_hdr section and PT_GNU_EH_FRAME segment header">;
53
54 def enable_new_dtags: F<"enable-new-dtags">,
55   HelpText<"Enable new dynamic tags">;
56
57 def end_lib: F<"end-lib">,
58   HelpText<"End a grouping of objects that should be treated as if they were together in an archive">;
59
60 def entry: S<"entry">, MetaVarName<"<entry>">,
61   HelpText<"Name of entry point symbol">;
62
63 def export_dynamic: F<"export-dynamic">,
64   HelpText<"Put symbols in the dynamic symbol table">;
65
66 def export_dynamic_symbol: S<"export-dynamic-symbol">,
67   HelpText<"Put a symbol in the dynamic symbol table">;
68
69 def fatal_warnings: F<"fatal-warnings">,
70   HelpText<"Treat warnings as errors">;
71
72 def fini: S<"fini">, MetaVarName<"<symbol>">,
73   HelpText<"Specify a finalizer function">;
74
75 def hash_style: S<"hash-style">,
76   HelpText<"Specify hash style (sysv, gnu or both)">;
77
78 def help: F<"help">, HelpText<"Print option help">;
79
80 def icf: F<"icf=all">, HelpText<"Enable identical code folding">;
81
82 def image_base : J<"image-base=">, HelpText<"Set the base address">;
83
84 def gc_sections: F<"gc-sections">,
85   HelpText<"Enable garbage collection of unused sections">;
86
87 def init: S<"init">, MetaVarName<"<symbol>">,
88   HelpText<"Specify an initializer function">;
89
90 def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">,
91   HelpText<"Root name of library to use">;
92
93 def lto_O: J<"lto-O">, MetaVarName<"<opt-level>">,
94   HelpText<"Optimization level for LTO">;
95
96 def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;
97
98 def no_as_needed: F<"no-as-needed">,
99   HelpText<"Always DT_NEEDED for shared libraries">;
100
101 def no_demangle: F<"no-demangle">,
102   HelpText<"Do not demangle symbol names">;
103
104 def no_gnu_unique: F<"no-gnu-unique">,
105   HelpText<"Disable STB_GNU_UNIQUE symbol binding">;
106
107 def no_whole_archive: F<"no-whole-archive">,
108   HelpText<"Restores the default behavior of loading archive members">;
109
110 def noinhibit_exec: F<"noinhibit-exec">,
111   HelpText<"Retain the executable output file whenever it is still usable">;
112
113 def no_undefined: F<"no-undefined">,
114   HelpText<"Report unresolved symbols even if the linker is creating a shared library">;
115
116 def no_undefined_version: F<"no-undefined-version">,
117   HelpText<"Report version scripts that refer undefined symbols">;
118
119 def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
120   HelpText<"Path to file to write output">;
121
122 def pie: F<"pie">, HelpText<"Create a position independent executable">;
123
124 def print_gc_sections: F<"print-gc-sections">,
125   HelpText<"List removed unused sections">;
126
127 def reproduce: S<"reproduce">,
128   HelpText<"Dump linker invocation and input files for debugging">;
129
130 def rpath: S<"rpath">, HelpText<"Add a DT_RUNPATH to the output">;
131
132 def relocatable: F<"relocatable">, HelpText<"Create relocatable object file">;
133
134 def script: S<"script">, HelpText<"Read linker script">;
135
136 def shared: F<"shared">, HelpText<"Build a shared object">;
137
138 def soname: J<"soname=">, HelpText<"Set DT_SONAME">;
139
140 def start_lib: F<"start-lib">,
141   HelpText<"Start a grouping of objects that should be treated as if they were together in an archive">;
142
143 def strip_all: F<"strip-all">, HelpText<"Strip all symbols">;
144
145 def strip_debug: F<"strip-debug">, HelpText<"Strip debugging information">;
146
147 def sysroot: J<"sysroot=">, HelpText<"Set the system root">;
148
149 def threads: F<"threads">, HelpText<"Enable use of threads">;
150
151 def trace: F<"trace">, HelpText<"Print the names of the input files">;
152
153 def trace_symbol : J<"trace-symbol=">, HelpText<"Trace references to symbols">;
154
155 def undefined: J<"undefined=">,
156   HelpText<"Force undefined symbol during linking">;
157
158 def unresolved_symbols: J<"unresolved-symbols=">,
159   HelpText<"Determine how to handle unresolved symbols">;
160
161 def rsp_quoting: J<"rsp-quoting=">,
162   HelpText<"Quoting style for response files. Values supported: windows|posix">;
163
164 def verbose: F<"verbose">, HelpText<"Verbose mode">;
165
166 def version: F<"version">, HelpText<"Display the version number">;
167
168 def version_script: S<"version-script">,
169   HelpText<"Read a version script">;
170
171 def warn_common: F<"warn-common">,
172   HelpText<"Warn about duplicate common symbols">;
173
174 def whole_archive: F<"whole-archive">,
175   HelpText<"Force load of all members in a static library">;
176
177 def wrap: S<"wrap">, MetaVarName<"<symbol>">,
178   HelpText<"Use wrapper functions for symbol">;
179
180 def z: JoinedOrSeparate<["-"], "z">, MetaVarName<"<option>">,
181   HelpText<"Linker option extensions">;
182
183 // Aliases
184 def alias_Bdynamic_call_shared: F<"call_shared">, Alias<Bdynamic>;
185 def alias_Bdynamic_dy: F<"dy">, Alias<Bdynamic>;
186 def alias_Bstatic_dn: F<"dn">, Alias<Bstatic>;
187 def alias_Bstatic_non_shared: F<"non_shared">, Alias<Bstatic>;
188 def alias_Bstatic_static: F<"static">, Alias<Bstatic>;
189 def alias_L__library_path: J<"library-path=">, Alias<L>;
190 def alias_discard_all_x: Flag<["-"], "x">, Alias<discard_all>;
191 def alias_discard_locals_X: Flag<["-"], "X">, Alias<discard_locals>;
192 def alias_dynamic_list: J<"dynamic-list=">, Alias<dynamic_list>;
193 def alias_entry_e: JoinedOrSeparate<["-"], "e">, Alias<entry>;
194 def alias_entry_entry: J<"entry=">, Alias<entry>;
195 def alias_export_dynamic_E: Flag<["-"], "E">, Alias<export_dynamic>;
196 def alias_export_dynamic_symbol: J<"export-dynamic-symbol=">,
197   Alias<export_dynamic_symbol>;
198 def alias_fini_fini: J<"fini=">, Alias<fini>;
199 def alias_hash_style_hash_style: J<"hash-style=">, Alias<hash_style>;
200 def alias_init_init: J<"init=">, Alias<init>;
201 def alias_l__library: J<"library=">, Alias<l>;
202 def alias_o_output: Joined<["--"], "output=">, Alias<o>;
203 def alias_pie_pic_executable: F<"pic-executable">, Alias<pie>;
204 def alias_relocatable_r: Flag<["-"], "r">, Alias<relocatable>;
205 def alias_rpath_R: Joined<["-"], "R">, Alias<rpath>;
206 def alias_rpath_rpath: J<"rpath=">, Alias<rpath>;
207 def alias_script_T: JoinedOrSeparate<["-"], "T">, Alias<script>;
208 def alias_shared_Bshareable: F<"Bshareable">, Alias<shared>;
209 def alias_soname_h: JoinedOrSeparate<["-"], "h">, Alias<soname>;
210 def alias_soname_soname: S<"soname">, Alias<soname>;
211 def alias_strip_all: Flag<["-"], "s">, Alias<strip_all>;
212 def alias_strip_debug_S: Flag<["-"], "S">, Alias<strip_debug>;
213 def alias_trace: Flag<["-"], "t">, Alias<trace>;
214 def alias_trace_symbol_y : JoinedOrSeparate<["-"], "y">, Alias<trace_symbol>;
215 def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>;
216 def alias_version_V: Flag<["-"], "V">, Alias<version>;
217 def alias_version_v: Flag<["-"], "v">, Alias<version>;
218 def alias_wrap_wrap: J<"wrap=">, Alias<wrap>;
219
220 // Our symbol resolution algorithm handles symbols in archive files differently
221 // than traditional linkers, so we don't need --start-group and --end-group.
222 // These options are recongized for compatibility but ignored.
223 def end_group: F<"end-group">;
224 def end_group_paren: Flag<["-"], ")">;
225 def start_group: F<"start-group">;
226 def start_group_paren: Flag<["-"], "(">;
227
228 // Ignore LTO plugin-related options.
229 // clang -flto passes -plugin and -plugin-opt to the linker. This is required
230 // for ld.gold and ld.bfd to get LTO working. But it's not for lld which doesn't
231 // rely on a plugin. Instead of detecting which linker is used on clang side we
232 // just ignore the option on lld side as it's easier. In fact, the linker could
233 // be called 'ld' and understanding which linker is used would require parsing of
234 // --version output.
235 def plugin: S<"plugin">;
236 def plugin_eq: J<"plugin=">;
237 def plugin_opt: S<"plugin-opt">;
238 def plugin_opt_eq: J<"plugin-opt=">;
239
240 // Options listed below are silently ignored for now for compatibility.
241 def allow_shlib_undefined: F<"allow-shlib-undefined">;
242 def define_common: F<"define-common">;
243 def demangle: F<"demangle">;
244 def detect_odr_violations: F<"detect-odr-violations">;
245 def no_add_needed: F<"no-add-needed">;
246 def no_allow_shlib_undefined: F<"no-allow-shlib-undefined">;
247 def no_copy_dt_needed_entries: F<"no-copy-dt-needed-entries">,
248   Alias<no_add_needed>;
249 def no_dynamic_linker: F<"no-dynamic-linker">;
250 def no_fatal_warnings: F<"no-fatal-warnings">;
251 def no_mmap_output_file: F<"no-mmap-output-file">;
252 def no_warn_common: F<"no-warn-common">;
253 def no_warn_mismatch: F<"no-warn-mismatch">;
254 def rpath_link: S<"rpath-link">;
255 def rpath_link_eq: J<"rpath-link=">;
256 def sort_common: F<"sort-common">;
257 def warn_execstack: F<"warn-execstack">;
258 def warn_shared_textrel: F<"warn-shared-textrel">;
259 def G: Separate<["-"], "G">;
260
261 // Aliases for ignored options
262 def alias_define_common_d: Flag<["-"], "d">, Alias<define_common>;
263 def alias_define_common_dc: F<"dc">, Alias<define_common>;
264 def alias_define_common_dp: F<"dp">, Alias<define_common>;
265 def alias_version_script_version_script: J<"version-script=">,
266   Alias<version_script>;
267
268 // LTO-related options.
269 def lto_jobs: J<"lto-jobs=">, HelpText<"Number of threads to run codegen">;
270 def lto_aa_pipeline: J<"lto-aa-pipeline=">,
271   HelpText<"AA pipeline to run during LTO. Used in conjunction with -lto-newpm-passes">;
272 def lto_newpm_passes: J<"lto-newpm-passes=">,
273   HelpText<"Passes to run during LTO">;
274 def disable_verify: F<"disable-verify">;
275 def mllvm: S<"mllvm">;
276 def save_temps: F<"save-temps">;