Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / MinGW / Options.td
blobfa4c4ecc75d654359900bd1630355a8ca822c0b9
1 include "llvm/Option/OptParser.td"
3 class F<string name>: Flag<["--", "-"], name>;
4 class J<string name>: Joined<["--", "-"], name>;
5 class S<string name>: Separate<["--", "-"], name>;
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>;
14 multiclass Eq<string name, string help> {
15   def NAME: Separate<["--", "-"], name>;
16   def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>,
17     HelpText<help>;
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>;
26 multiclass EqLong<string name, string help> {
27   def NAME: Separate<["--"], name>;
28   def NAME # _eq: Joined<["--"], name # "=">, Alias<!cast<Separate>(NAME)>,
29     HelpText<help>;
32 multiclass EqNoHelp<string name> {
33   def NAME: Separate<["--", "-"], name>;
34   def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>;
37 multiclass B<string name, string help1, string help2> {
38   def NAME: Flag<["--", "-"], name>, HelpText<help1>;
39   def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>;
42 multiclass B_disable<string name, string help1, string help2> {
43   def NAME: Flag<["--", "-"], name>, HelpText<help1>;
44   def disable_ # NAME: Flag<["--", "-"], "disable-" # name>, HelpText<help2>;
47 multiclass B_enable_disable<string name, string help1, string help2> {
48   def enable_ # NAME: Flag<["--", "-"], "enable-" # name>, HelpText<help1>;
49   def disable_ # NAME: Flag<["--", "-"], "disable-" # name>, HelpText<help2>;
52 def L: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">,
53   HelpText<"Add a directory to the library search path">;
54 defm allow_multiple_definition: B<"allow-multiple-definition",
55     "Allow multiple definitions",
56     "Do not allow multiple definitions (default)">;
57 def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">;
58 def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">;
59 defm demangle: B<"demangle",
60     "Demangle symbol names (default)",
61     "Do not demangle symbol names">;
62 def disable_auto_import: F<"disable-auto-import">,
63     HelpText<"Don't automatically import data symbols from other DLLs without dllimport">;
64 def disable_runtime_pseudo_reloc: F<"disable-runtime-pseudo-reloc">,
65     HelpText<"Don't do automatic imports that require runtime fixups">;
66 def disable_stdcall_fixup: F<"disable-stdcall-fixup">,
67     HelpText<"Don't resolve stdcall/fastcall/vectorcall to undecorated symbols">;
68 defm dynamicbase: B_disable<"dynamicbase", "Enable ASLR", "Disable ASLR">;
69 def enable_auto_import: F<"enable-auto-import">,
70     HelpText<"Automatically import data symbols from other DLLs where needed">;
71 def enable_runtime_pseudo_reloc: F<"enable-runtime-pseudo-reloc">,
72     HelpText<"Allow automatic imports that require runtime fixups">;
73 def enable_stdcall_fixup: F<"enable-stdcall-fixup">,
74     HelpText<"Resolve stdcall/fastcall/vectorcall to undecorated symbols without warnings">;
75 defm entry: Eq<"entry", "Name of entry point symbol">, MetaVarName<"<entry>">;
76 def exclude_all_symbols: F<"exclude-all-symbols">,
77     HelpText<"Don't automatically export any symbols">;
78 defm exclude_symbols: Eq<"exclude-symbols",
79     "Exclude symbols from automatic export">, MetaVarName<"<symbol[,symbol,...]>">;
80 def export_all_symbols: F<"export-all-symbols">,
81     HelpText<"Export all symbols even if a def file or dllexport attributes are used">;
82 defm fatal_warnings: B<"fatal-warnings",
83     "Treat warnings as errors",
84     "Do not treat warnings as errors (default)">;
85 defm file_alignment: Eq<"file-alignment", "Set file alignment">;
86 defm gc_sections: B<"gc-sections",
87     "Remove unused sections",
88     "Don't remove unused sections">;
89 defm heap: Eq<"heap", "Set size of the initial heap">;
90 def help: F<"help">, HelpText<"Print option help">;
91 defm high_entropy_va: B_disable<"high-entropy-va",
92     "Set the 'high entropy VA' flag", "Don't set the 'high entropy VA' flag">;
93 defm icf: Eq<"icf", "Identical code folding">;
94 defm image_base: Eq<"image-base", "Base address of the program">;
95 defm insert_timestamp: B<"insert-timestamp",
96     "Include PE header timestamp",
97     "Don't include PE header timestamp">;
98 def kill_at: F<"kill-at">, HelpText<"Remove @n from exported symbols">;
99 def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">,
100   HelpText<"Root name of library to use">;
101 def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;
102 defm major_os_version: EqLong<"major-os-version",
103      "Set the OS and subsystem major version">;
104 defm major_subsystem_version: EqLong<"major-subsystem-version",
105      "Set the OS and subsystem major version">;
106 defm map: Eq<"Map", "Output a linker map">;
107 defm minor_os_version: EqLong<"minor-os-version",
108      "Set the OS and subsystem minor version">;
109 defm minor_subsystem_version: EqLong<"minor-subsystem-version",
110      "Set the OS and subsystem minor version">;
111 defm no_seh: B_disable<"no-seh",
112      "Set the 'no SEH' flag in the executable", "Don't set the 'no SEH' flag">;
113 defm nxcompat: B_disable<"nxcompat",
114     "Set the 'nxcompat' flag in the executable", "Don't set the 'nxcompat' flag">;
115 def large_address_aware: Flag<["--"], "large-address-aware">,
116     HelpText<"Enable large addresses">;
117 def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
118   HelpText<"Path to file to write output">;
119 defm out_implib: Eq<"out-implib", "Import library name">;
120 defm output_def: Eq<"output-def", "Output def file">;
121 defm reloc_section: B_enable_disable<"reloc-section",
122      "Enable base relocations", "Disable base relocations">;
123 defm section_alignment: Eq<"section-alignment", "Set section alignment">;
124 def shared: F<"shared">, HelpText<"Build a shared object">;
125 defm subs: Eq<"subsystem", "Specify subsystem">;
126 defm stack: Eq<"stack", "Set size of the initial stack">;
127 def strip_all: F<"strip-all">,
128     HelpText<"Omit all symbol information from the output binary">;
129 def strip_debug: F<"strip-debug">,
130     HelpText<"Omit all debug information, but keep symbol information">;
131 defm reproduce: Eq<"reproduce",
132      "Write a tar file containing input files and command line options to reproduce link">;
133 defm require_defined: Eq<"require-defined",
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">;
139 defm tsaware: B_disable<"tsaware",
140     "Set the 'Terminal Server aware' flag", "Don't set the 'Terminal Server aware' flag">;
141 defm undefined: Eq<"undefined", "Include symbol in the link, if available">;
142 defm whole_archive: B<"whole-archive",
143     "Include all object files for following archives",
144     "No longer include all object files for following archives">;
145 def v: Flag<["-"], "v">, HelpText<"Display the version number">;
146 def verbose: F<"verbose">, HelpText<"Verbose mode">;
147 def version: F<"version">, HelpText<"Display the version number and exit">;
148 defm wrap: Eq<"wrap", "Use wrapper functions for symbol">,
149      MetaVarName<"<symbol>">;
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">;
161 def thinlto_jobs_eq: JJ<"thinlto-jobs=">,
162   HelpText<"Number of ThinLTO jobs. Default to --threads=">;
164 def plugin_opt_eq_minus: J<"plugin-opt=-">,
165   HelpText<"Specify an LLVM option for compatibility with LLVMgold.so">;
166 def: J<"plugin-opt=thinlto">;
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=">;
176 def plugin_opt_mcpu_eq: J<"plugin-opt=mcpu=">;
178 // This may be either an unhandled LLVMgold.so feature or GCC passed
179 // -plugin-opt=path/to/{liblto_plugin.so,lto-wrapper}
180 def plugin_opt_eq : J<"plugin-opt=">;
182 // LLD specific options
183 def _HASH_HASH_HASH : Flag<["-"], "###">,
184     HelpText<"Print (but do not run) the commands to run for this compilation">;
185 def appcontainer: F<"appcontainer">, HelpText<"Set the appcontainer flag in the executable">;
186 defm delayload: Eq<"delayload", "DLL to load only on demand">;
187 defm mllvm: EqNoHelp<"mllvm">;
188 defm pdb: Eq<"pdb", "Output PDB debug info file, chosen implicitly if the argument is empty">;
189 defm thinlto_cache_dir: EqLong<"thinlto-cache-dir",
190   "Path to ThinLTO cached object file directory">;
191 defm Xlink : Eq<"Xlink", "Pass <arg> to the COFF linker">, MetaVarName<"<arg>">;
192 defm guard_cf : B<"guard-cf", "Enable Control Flow Guard" ,
193   "Do not enable Control Flow Guard (default)">;
194 defm guard_longjmp : B<"guard-longjmp",
195   "Enable Control Flow Guard long jump hardening (default for --guard-cf)" ,
196   "Do not enable Control Flow Guard long jump hardening">;
197 defm error_limit:
198   EqLong<"error-limit", "Maximum number of errors to emit before stopping (0 = no limit)">;
200 // Alias
201 def alias_Bdynamic_call_shared: Flag<["-"], "call_shared">, Alias<Bdynamic>;
202 def alias_Bdynamic_dy: Flag<["-"], "dy">, Alias<Bdynamic>;
203 def alias_Bstatic_dn: Flag<["-"], "dn">, Alias<Bstatic>;
204 def alias_Bstatic_non_shared: Flag<["-"], "non_shared">, Alias<Bstatic>;
205 def alias_Bstatic_static: Flag<["-"], "static">, Alias<Bstatic>;
206 def alias_dll: F<"dll">, Alias<shared>;
207 def alias_entry_e: JoinedOrSeparate<["-"], "e">, Alias<entry>;
208 def alias_no_dynamicbase: F<"no-dynamicbase">, Alias<disable_dynamicbase>;
209 def alias_strip_s: Flag<["-"], "s">, Alias<strip_all>;
210 def alias_strip_S: Flag<["-"], "S">, Alias<strip_debug>;
211 def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>;
213 // Ignored options
214 def: Joined<["-"], "O">;
215 def: F<"as-needed">;
216 def: F<"build-id">;
217 def: F<"disable-auto-image-base">;
218 def: F<"enable-auto-image-base">;
219 def: F<"end-group">;
220 def: Flag<["--"], "full-shutdown">;
221 defm: EqNoHelp<"major-image-version">;
222 defm: EqNoHelp<"minor-image-version">;
223 def: F<"no-undefined">;
224 def: F<"pic-executable">;
225 defm: EqNoHelp<"plugin">;
226 defm: EqNoHelp<"sysroot">;
227 def: F<"sort-common">;
228 def: F<"start-group">;
230 // Ignore GCC collect2 LTO plugin related options. Note that we don't support
231 // GCC LTO, but GCC collect2 passes these options even in non-LTO mode.
232 def: J<"plugin-opt=-fresolution=">;
233 def: J<"plugin-opt=-pass-through=">;