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