llvm-project

Форк
0
/
Options.td 
302 строки · 11.8 Кб
1
include "llvm/Option/OptParser.td"
2

3
// Convenience classes for long options which only accept two dashes. For lld
4
// specific or newer long options, we prefer two dashes to avoid collision with
5
// short options. For many others, we have to accept both forms to be compatible
6
// with GNU ld.
7
class FF<string name> : Flag<["--"], name>;
8
class JJ<string name>: Joined<["--"], name>;
9

10
multiclass EEq<string name, string help> {
11
  def NAME: Separate<["--"], name>;
12
  def NAME # _eq: Joined<["--"], name # "=">, Alias<!cast<Separate>(NAME)>,
13
    HelpText<help>;
14
}
15

16
multiclass BB<string name, string help1, string help2> {
17
  def NAME: Flag<["--"], name>, HelpText<help1>;
18
  def no_ # NAME: Flag<["--"], "no-" # name>, HelpText<help2>;
19
}
20

21
// For options whose names are multiple letters, either one dash or
22
// two can precede the option name except those that start with 'o'.
23
class F<string name>: Flag<["--", "-"], name>;
24
class J<string name>: Joined<["--", "-"], name>;
25
class S<string name>: Separate<["--", "-"], name>;
26

27
multiclass Eq<string name, string help> {
28
  def NAME: Separate<["--", "-"], name>;
29
  def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>,
30
    HelpText<help>;
31
}
32

33
multiclass B<string name, string help1, string help2> {
34
  def NAME: Flag<["--", "-"], name>, HelpText<help1>;
35
  def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>;
36
}
37

38
// The following flags are shared with the ELF linker
39
def Bsymbolic: F<"Bsymbolic">, HelpText<"Bind defined symbols locally">;
40

41
def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">;
42

43
def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries (default)">;
44

45
def build_id: F<"build-id">, HelpText<"Alias for --build-id=fast">;
46

47
def build_id_eq: J<"build-id=">, HelpText<"Generate build ID note">,
48
  MetaVarName<"[fast,sha1,uuid,0x<hexstring>]">;
49

50
defm color_diagnostics: B<"color-diagnostics",
51
  "Alias for --color-diagnostics=always",
52
  "Alias for --color-diagnostics=never">;
53
def color_diagnostics_eq: J<"color-diagnostics=">,
54
  HelpText<"Use colors in diagnostics (default: auto)">,
55
  MetaVarName<"[auto,always,never]">;
56

57
def compress_relocations: F<"compress-relocations">,
58
  HelpText<"Compress the relocation targets in the code section.">;
59

60
defm demangle: B<"demangle",
61
    "Demangle symbol names",
62
    "Do not demangle symbol names">;
63

64
def emit_relocs: F<"emit-relocs">, HelpText<"Generate relocations in output">;
65

66
def error_unresolved_symbols: F<"error-unresolved-symbols">,
67
  HelpText<"Report unresolved symbols as errors">;
68

69
defm export_dynamic: B<"export-dynamic",
70
    "Put symbols in the dynamic symbol table",
71
    "Do not put symbols in the dynamic symbol table (default)">;
72

73
def end_lib: F<"end-lib">,
74
  HelpText<"End a grouping of objects that should be treated as if they were together in an archive">;
75

76
def entry: S<"entry">, MetaVarName<"<entry>">,
77
  HelpText<"Name of entry point symbol">;
78

79
defm error_limit:
80
  EEq<"error-limit", "Maximum number of errors to emit before stopping (0 = no limit)">;
81

82
def fatal_warnings: F<"fatal-warnings">,
83
  HelpText<"Treat warnings as errors">;
84

85
defm gc_sections: B<"gc-sections",
86
    "Enable garbage collection of unused sections",
87
    "Disable garbage collection of unused sections">;
88

89
defm merge_data_segments: BB<"merge-data-segments",
90
    "Enable merging data segments",
91
    "Disable merging data segments">;
92

93
def help: F<"help">, HelpText<"Print option help">;
94

95
def library: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">,
96
  HelpText<"Root name of library to use">;
97

98
def library_path: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">,
99
  HelpText<"Add a directory to the library search path">;
100

101
def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;
102

103
defm mllvm: Eq<"mllvm", "Additional arguments to forward to LLVM's option processing">;
104

105
defm Map: Eq<"Map", "Print a link map to the specified file">;
106

107
def no_fatal_warnings: F<"no-fatal-warnings">;
108

109
def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
110
  HelpText<"Path to file to write output">;
111

112
def O: JoinedOrSeparate<["-"], "O">, HelpText<"Optimize output file size">;
113

114
defm pie: B<"pie",
115
    "Create a position independent executable",
116
    "Do not create a position independent executable (default)">;
117

118
defm print_gc_sections: B<"print-gc-sections",
119
    "List removed unused sections",
120
    "Do not list removed unused sections">;
121

122
def print_map: F<"print-map">,
123
  HelpText<"Print a link map to the standard output">;
124

125
def relocatable: F<"relocatable">, HelpText<"Create relocatable object file">;
126

127
defm reproduce: EEq<"reproduce", "Dump linker invocation and input files for debugging">;
128

129
defm rsp_quoting: Eq<"rsp-quoting", "Quoting style for response files">,
130
  MetaVarName<"[posix,windows]">;
131

132
def shared: F<"shared">, HelpText<"Build a shared object">;
133

134
def start_lib: F<"start-lib">,
135
  HelpText<"Start a grouping of objects that should be treated as if they were together in an archive">;
136

137
def strip_all: F<"strip-all">, HelpText<"Strip all symbols">;
138

139
def strip_debug: F<"strip-debug">, HelpText<"Strip debugging information">;
140

141
defm threads
142
    : Eq<"threads", "Number of threads. '1' disables multi-threading. By "
143
                    "default all available hardware threads are used">;
144

145
def trace: F<"trace">, HelpText<"Print the names of the input files">;
146

147
defm trace_symbol: Eq<"trace-symbol", "Trace references to symbols">;
148

149
defm undefined: Eq<"undefined", "Force undefined symbol during linking">;
150

151
defm unresolved_symbols:
152
  Eq<"unresolved-symbols", "Determine how to handle unresolved symbols">;
153

154
def v: Flag<["-"], "v">, HelpText<"Display the version number">;
155

156
def verbose: F<"verbose">, HelpText<"Verbose mode">;
157

158
def version: F<"version">, HelpText<"Display the version number and exit">;
159

160
def warn_unresolved_symbols: F<"warn-unresolved-symbols">,
161
  HelpText<"Report unresolved symbols as warnings">;
162

163
defm wrap: Eq<"wrap", "Use wrapper functions for symbol">,
164
  MetaVarName<"<symbol>=<symbol>">;
165

166
def z: JoinedOrSeparate<["-"], "z">, MetaVarName<"<option>">,
167
  HelpText<"Linker option extensions">;
168

169
// The follow flags are unique to wasm
170

171
def allow_undefined: F<"allow-undefined">,
172
  HelpText<"Allow undefined symbols in linked binary. "
173
           "This options is equivalent to --import-undefined "
174
           "and --unresolved-symbols=ignore-all">;
175

176
def import_undefined: F<"import-undefined">,
177
  HelpText<"Turn undefined symbols into imports where possible">;
178

179
def allow_undefined_file: J<"allow-undefined-file=">,
180
  HelpText<"Allow symbols listed in <file> to be undefined in linked binary">;
181

182
def allow_undefined_file_s: Separate<["-"], "allow-undefined-file">,
183
  Alias<allow_undefined_file>;
184

185
defm export: Eq<"export", "Force a symbol to be exported">;
186

187
defm export_if_defined: Eq<"export-if-defined",
188
     "Force a symbol to be exported, if it is defined in the input">;
189

190
def export_all: FF<"export-all">,
191
  HelpText<"Export all symbols (normally combined with --no-gc-sections)">;
192

193
def export_table: FF<"export-table">,
194
  HelpText<"Export function table to the environment">;
195

196
def growable_table: FF<"growable-table">,
197
  HelpText<"Remove maximum size from function table, allowing table to grow">;
198

199
def global_base: JJ<"global-base=">,
200
  HelpText<"Memory offset at which to place global data (Defaults to 1024)">;
201

202
defm keep_section: Eq<"keep-section",
203
     "Preserve a section even when --strip-all is given. This is useful for compiler drivers such as clang or emcc that, for example, depend on the features section for post-link processing. Can be specified multiple times to keep multiple sections">;
204

205
def import_memory: FF<"import-memory">,
206
  HelpText<"Import the module's memory from the default module of \"env\" with the name \"memory\".">;
207
def import_memory_with_name: JJ<"import-memory=">,
208
  HelpText<"Import the module's memory from the passed module with the passed name.">,
209
  MetaVarName<"<module>,<name>">;
210

211
def export_memory: FF<"export-memory">,
212
  HelpText<"Export the module's memory with the default name of \"memory\"">;
213
def export_memory_with_name: JJ<"export-memory=">,
214
  HelpText<"Export the module's memory with the passed name">;
215

216
def shared_memory: FF<"shared-memory">,
217
  HelpText<"Use shared linear memory">;
218

219
defm soname: Eq<"soname", "Set the module name in the generated name section">;
220

221
def import_table: FF<"import-table">,
222
  HelpText<"Import function table from the environment">;
223

224
def initial_heap: JJ<"initial-heap=">,
225
  HelpText<"Initial size of the heap">;
226

227
def initial_memory: JJ<"initial-memory=">,
228
  HelpText<"Initial size of the linear memory">;
229

230
def max_memory: JJ<"max-memory=">,
231
  HelpText<"Maximum size of the linear memory">;
232

233
def no_growable_memory: FF<"no-growable-memory">,
234
  HelpText<"Set maximum size of the linear memory to its initial size">;
235

236
def no_entry: FF<"no-entry">,
237
  HelpText<"Do not output any entry point">;
238

239
def stack_first: FF<"stack-first">,
240
  HelpText<"Place stack at start of linear memory rather than after data">;
241

242
def table_base: JJ<"table-base=">,
243
  HelpText<"Table offset at which to place address taken functions (Defaults to 1)">;
244

245
defm whole_archive: B<"whole-archive",
246
    "Force load of all members in a static library",
247
    "Do not force load of all members in a static library (default)">;
248

249
def why_extract: JJ<"why-extract=">, HelpText<"Print to a file about why archive members are extracted">;
250

251
defm check_features: BB<"check-features",
252
    "Check feature compatibility of linked objects (default)",
253
    "Ignore feature compatibility of linked objects">;
254

255
def features: CommaJoined<["--", "-"], "features=">,
256
  HelpText<"Comma-separated used features, inferred from input objects by default.">;
257

258
def extra_features: CommaJoined<["--", "-"], "extra-features=">,
259
  HelpText<"Comma-separated list of features to add to the default set of features inferred from input objects.">;
260

261
// Aliases
262
def: JoinedOrSeparate<["-"], "e">, Alias<entry>;
263
def: J<"entry=">, Alias<entry>;
264
def: F<"call_shared">, Alias<Bdynamic>, HelpText<"Alias for --Bdynamic">;
265
def: F<"dy">, Alias<Bdynamic>, HelpText<"Alias for --Bdynamic">;
266
def: F<"dn">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">;
267
def: F<"non_shared">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">;
268
def: F<"static">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">;
269
def: Flag<["-"], "E">, Alias<export_dynamic>, HelpText<"Alias for --export-dynamic">;
270
def: Flag<["-"], "i">, Alias<initial_memory>;
271
def: Separate<["--", "-"], "library">, Alias<library>;
272
def: Joined<["--", "-"], "library=">, Alias<library>;
273
def: Separate<["--", "-"], "library-path">, Alias<library_path>;
274
def: Joined<["--", "-"], "library-path=">, Alias<library_path>;
275
def: Flag<["-"], "M">, Alias<print_map>, HelpText<"Alias for --print-map">;
276
def: Flag<["-"], "r">, Alias<relocatable>;
277
def: Flag<["-"], "s">, Alias<strip_all>, HelpText<"Alias for --strip-all">;
278
def: Flag<["-"], "S">, Alias<strip_debug>, HelpText<"Alias for --strip-debug">;
279
def: Flag<["-"], "t">, Alias<trace>, HelpText<"Alias for --trace">;
280
def: JoinedOrSeparate<["-"], "y">, Alias<trace_symbol>, HelpText<"Alias for --trace-symbol">;
281
def: JoinedOrSeparate<["-"], "u">, Alias<undefined>;
282

283
// LTO-related options.
284
def lto_O: JJ<"lto-O">, MetaVarName<"<opt-level>">,
285
  HelpText<"Optimization level for LTO">;
286
def lto_CGO: JJ<"lto-CGO">, MetaVarName<"<cgopt-level>">,
287
  HelpText<"Codegen optimization level for LTO">;
288
def lto_partitions: JJ<"lto-partitions=">,
289
  HelpText<"Number of LTO codegen partitions">;
290
def disable_verify: F<"disable-verify">;
291
def save_temps: F<"save-temps">, HelpText<"Save intermediate LTO compilation results">;
292
def thinlto_cache_dir: JJ<"thinlto-cache-dir=">,
293
  HelpText<"Path to ThinLTO cached object file directory">;
294
defm thinlto_cache_policy: EEq<"thinlto-cache-policy", "Pruning policy for the ThinLTO cache">;
295
def thinlto_jobs: JJ<"thinlto-jobs=">,
296
  HelpText<"Number of ThinLTO jobs. Default to --threads=">;
297
def lto_debug_pass_manager: FF<"lto-debug-pass-manager">,
298
  HelpText<"Debug new pass manager">;
299

300
// Experimental PIC mode.
301
def experimental_pic: FF<"experimental-pic">,
302
  HelpText<"Enable Experimental PIC">;
303

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.