@@ -4,12 +4,25 @@ class F<string name>: Flag<["--", "-"], name>;
4
4
class J<string name>: Joined<["--", "-"], name>;
5
5
class S<string name>: Separate<["--", "-"], name>;
6
6
7
+ // Convenience classes for long options which only accept two dashes. For lld
8
+ // specific or newer long options, we prefer two dashes to avoid collision with
9
+ // short options. For many others, we have to accept both forms to be compatible
10
+ // with GNU ld.
11
+ class FF<string name> : Flag<["--"], name>;
12
+ class JJ<string name>: Joined<["--"], name>;
13
+
7
14
multiclass Eq<string name, string help> {
8
15
def NAME: Separate<["--", "-"], name>;
9
16
def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>,
10
17
HelpText<help>;
11
18
}
12
19
20
+ multiclass EEq<string name, string help> {
21
+ def NAME: Separate<["--"], name>;
22
+ def NAME # _eq: Joined<["--"], name # "=">, Alias<!cast<Separate>(NAME)>,
23
+ HelpText<help>;
24
+ }
25
+
13
26
multiclass EqLong<string name, string help> {
14
27
def NAME: Separate<["--"], name>;
15
28
def NAME # _eq: Joined<["--"], name # "=">, Alias<!cast<Separate>(NAME)>,
@@ -119,6 +132,10 @@ defm reproduce: Eq<"reproduce",
119
132
"Write a tar file containing input files and command line options to reproduce link">;
120
133
defm require_defined: Eq<"require-defined",
121
134
"Force symbol to be added to symbol table as an undefined one">;
135
+ defm threads
136
+ : EEq<"threads",
137
+ "Number of threads. '1' disables multi-threading. By default all "
138
+ "available hardware threads are used">;
122
139
defm tsaware: B_disable<"tsaware",
123
140
"Set the 'Terminal Server aware' flag", "Don't set the 'Terminal Server aware' flag">;
124
141
defm undefined: Eq<"undefined", "Include symbol in the link, if available">;
@@ -131,9 +148,33 @@ def version: F<"version">, HelpText<"Display the version number and exit">;
131
148
defm wrap: Eq<"wrap", "Use wrapper functions for symbol">,
132
149
MetaVarName<"<symbol>">;
133
150
151
+
152
+ def lto_O: JJ<"lto-O">, MetaVarName<"<opt-level>">,
153
+ HelpText<"Optimization level for LTO">;
154
+ def lto_CGO: JJ<"lto-CGO">, MetaVarName<"<cgopt-level>">,
155
+ HelpText<"Codegen optimization level for LTO">;
156
+ def lto_cs_profile_generate: FF<"lto-cs-profile-generate">,
157
+ HelpText<"Perform context sensitive PGO instrumentation">;
158
+ def lto_cs_profile_file: JJ<"lto-cs-profile-file=">,
159
+ HelpText<"Context sensitive profile file path">;
160
+
161
+ def thinlto_jobs_eq: JJ<"thinlto-jobs=">,
162
+ HelpText<"Number of ThinLTO jobs. Default to --threads=">;
163
+
134
164
def plugin_opt_eq_minus: J<"plugin-opt=-">,
135
165
HelpText<"Specify an LLVM option for compatibility with LLVMgold.so">;
166
+ def: J<"plugin-opt=thinlto">;
167
+
168
+ def: J<"plugin-opt=O">, Alias<lto_O>, HelpText<"Alias for --lto-O">;
169
+ def: F<"plugin-opt=cs-profile-generate">,
170
+ Alias<lto_cs_profile_generate>, HelpText<"Alias for --lto-cs-profile-generate">;
171
+ def: J<"plugin-opt=cs-profile-path=">,
172
+ Alias<lto_cs_profile_file>, HelpText<"Alias for --lto-cs-profile-file">;
173
+ def plugin_opt_dwo_dir_eq: J<"plugin-opt=dwo_dir=">,
174
+ HelpText<"Directory to store .dwo files when LTO and debug fission are used">;
175
+ def: J<"plugin-opt=jobs=">, Alias<thinlto_jobs_eq>, HelpText<"Alias for --thinlto-jobs=">;
136
176
def plugin_opt_mcpu_eq: J<"plugin-opt=mcpu=">;
177
+
137
178
// This may be either an unhandled LLVMgold.so feature or GCC passed
138
179
// -plugin-opt=path/to/{liblto_plugin.so,lto-wrapper}
139
180
def plugin_opt_eq : J<"plugin-opt=">;
0 commit comments