]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lld/COFF/Options.td
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lld / COFF / Options.td
1 include "llvm/Option/OptParser.td"
2
3 // link.exe accepts options starting with either a dash or a slash.
4
5 // Flag that takes no arguments.
6 class F<string name> : Flag<["/", "-", "/?", "-?"], name>;
7
8 // Flag that takes one argument after ":".
9 class P<string name, string help> :
10       Joined<["/", "-", "/?", "-?"], name#":">, HelpText<help>;
11
12 // Boolean flag which can be suffixed by ":no". Using it unsuffixed turns the
13 // flag on and using it suffixed by ":no" turns it off.
14 multiclass B<string name, string help_on, string help_off> {
15   def "" : F<name>, HelpText<help_on>;
16   def _no : F<name#":no">, HelpText<help_off>;
17 }
18
19 // Same as B<> above, but without help texts, for private undocumented
20 // options.
21 multiclass B_priv<string name> {
22   def "" : F<name>;
23   def _no : F<name#":no">;
24 }
25
26 def align   : P<"align", "Section alignment">;
27 def aligncomm : P<"aligncomm", "Set common symbol alignment">;
28 def alternatename : P<"alternatename", "Define weak alias">;
29 def base    : P<"base", "Base address of the program">;
30 def color_diagnostics: Flag<["--"], "color-diagnostics">,
31     HelpText<"Use colors in diagnostics">;
32 def color_diagnostics_eq: Joined<["--"], "color-diagnostics=">,
33     HelpText<"Use colors in diagnostics; one of 'always', 'never', 'auto'">;
34 def defaultlib : P<"defaultlib", "Add the library to the list of input files">;
35 def delayload : P<"delayload", "Delay loaded DLL name">;
36 def entry   : P<"entry", "Name of entry point symbol">;
37 def errorlimit : P<"errorlimit",
38     "Maximum number of errors to emit before stopping (0 = no limit)">;
39 def export  : P<"export", "Export a function">;
40 // No help text because /failifmismatch is not intended to be used by the user.
41 def failifmismatch : P<"failifmismatch", "">;
42 def filealign : P<"filealign", "Section alignment in the output file">;
43 def functionpadmin : F<"functionpadmin">;
44 def functionpadmin_opt : P<"functionpadmin",
45     "Prepares an image for hotpatching">;
46 def guard   : P<"guard", "Control flow guard">;
47 def heap    : P<"heap", "Size of the heap">;
48 def ignore : P<"ignore", "Specify warning codes to ignore">;
49 def implib  : P<"implib", "Import library name">;
50 def lib : F<"lib">,
51     HelpText<"Act like lib.exe; must be first argument if present">;
52 def libpath : P<"libpath", "Additional library search path">;
53 def linkrepro : P<"linkrepro",
54     "Dump linker invocation and input files for debugging">;
55 def lldignoreenv : F<"lldignoreenv">,
56     HelpText<"Ignore environment variables like %LIB%">;
57 def lldltocache : P<"lldltocache",
58     "Path to ThinLTO cached object file directory">;
59 def lldltocachepolicy : P<"lldltocachepolicy",
60     "Pruning policy for the ThinLTO cache">;
61 def lldsavetemps : F<"lldsavetemps">,
62     HelpText<"Save temporary files instead of deleting them">;
63 def machine : P<"machine", "Specify target platform">;
64 def merge   : P<"merge", "Combine sections">;
65 def mllvm   : P<"mllvm", "Options to pass to LLVM">;
66 def nodefaultlib : P<"nodefaultlib", "Remove a default library">;
67 def opt     : P<"opt", "Control optimizations">;
68 def order   : P<"order", "Put functions in order">;
69 def out     : P<"out", "Path to file to write output">;
70 def natvis : P<"natvis", "Path to natvis file to embed in the PDB">;
71 def no_color_diagnostics: F<"no-color-diagnostics">,
72     HelpText<"Do not use colors in diagnostics">;
73 def pdb : P<"pdb", "PDB file path">;
74 def pdbstripped : P<"pdbstripped", "Stripped PDB file path">;
75 def pdbaltpath : P<"pdbaltpath", "PDB file path to embed in the image">;
76 def pdbstream : Joined<["/", "-", "/?", "-?"], "pdbstream:">,
77     MetaVarName<"<name>=<file>">,
78     HelpText<"Embed the contents of <file> in the PDB as named stream <name>">;
79 def section : P<"section", "Specify section attributes">;
80 def stack   : P<"stack", "Size of the stack">;
81 def stub    : P<"stub", "Specify DOS stub file">;
82 def subsystem : P<"subsystem", "Specify subsystem">;
83 def timestamp : P<"timestamp", "Specify the PE header timestamp">;
84 def version : P<"version", "Specify a version number in the PE header">;
85 def wholearchive_file : P<"wholearchive",
86     "Include all object files from this library">;
87
88 def disallowlib : Joined<["/", "-", "/?", "-?"], "disallowlib:">,
89     Alias<nodefaultlib>;
90
91 def manifest : F<"manifest">, HelpText<"Create .manifest file">;
92 def manifest_colon : P<
93     "manifest",
94     "NO disables manifest output; EMBED[,ID=#] embeds manifest as resource in the image">;
95 def manifestuac : P<"manifestuac", "User access control">;
96 def manifestfile : P<"manifestfile", "Manifest output path, with /manifest">;
97 def manifestdependency : P<
98     "manifestdependency",
99     "Attributes for <dependency> element in manifest file; implies /manifest">;
100 def manifestinput : P<
101     "manifestinput",
102     "Additional manifest inputs; only valid with /manifest:embed">;
103
104 // We cannot use multiclass P because class name "incl" is different
105 // from its command line option name. We do this because "include" is
106 // a reserved keyword in tablegen.
107 def incl : Joined<["/", "-", "/?", "-?"], "include:">,
108     HelpText<"Force symbol to be added to symbol table as undefined one">;
109
110 // "def" is also a keyword.
111 def deffile : Joined<["/", "-", "/?", "-?"], "def:">,
112     HelpText<"Use module-definition file">;
113
114 def debug : F<"debug">, HelpText<"Embed a symbol table in the image">;
115 def debug_opt : P<"debug", "Embed a symbol table in the image with option">;
116 def debugtype : P<"debugtype", "Debug Info Options">;
117 def dll : F<"dll">, HelpText<"Create a DLL">;
118 def driver : F<"driver">, HelpText<"Generate a Windows NT Kernel Mode Driver">;
119 def driver_wdm : F<"driver:wdm">,
120     HelpText<"Set IMAGE_FILE_UP_SYSTEM_ONLY bit in PE header">;
121 def driver_uponly : F<"driver:uponly">,
122     HelpText<"Set IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER bit in PE header">;
123 def driver_wdm_uponly : F<"driver:wdm,uponly">;
124 def driver_uponly_wdm : F<"driver:uponly,wdm">;
125 def nodefaultlib_all : F<"nodefaultlib">,
126     HelpText<"Remove all default libraries">;
127 def noentry : F<"noentry">,
128     HelpText<"Don't add reference to DllMainCRTStartup; only valid with /dll">;
129 def profile : F<"profile">;
130 def repro : F<"Brepro">,
131     HelpText<"Use a hash of the executable as the PE header timestamp">;
132 def reproduce : P<"reproduce",
133     "Dump linker invocation and input files for debugging">;
134 def swaprun : P<"swaprun",
135   "Comma-separated list of 'cd' or 'net'">;
136 def swaprun_cd : F<"swaprun:cd">, Alias<swaprun>, AliasArgs<["cd"]>,
137   HelpText<"Make loader run output binary from swap instead of from CD">;
138 def swaprun_net : F<"swaprun:net">, Alias<swaprun>, AliasArgs<["net"]>,
139   HelpText<"Make loader run output binary from swap instead of from network">;
140 def verbose : F<"verbose">;
141 def wholearchive_flag : F<"wholearchive">,
142     HelpText<"Include all object files from all libraries">;
143
144 def force : F<"force">,
145     HelpText<"Allow undefined and multiply defined symbols">;
146 def force_unresolved : F<"force:unresolved">,
147     HelpText<"Allow undefined symbols when creating executables">;
148 def force_multiple : F<"force:multiple">,
149     HelpText<"Allow multiply defined symbols when creating executables">;
150 def force_multipleres : F<"force:multipleres">,
151     HelpText<"Allow multiply defined resources when creating executables">;
152 defm WX : B<"WX", "Treat warnings as errors", "Don't treat warnings as errors">;
153
154 defm allowbind : B<"allowbind", "Enable DLL binding (default)",
155                    "Disable DLL binding">;
156 defm allowisolation : B<"allowisolation", "Enable DLL isolation (default)",
157                         "Disable DLL isolation">;
158 defm appcontainer : B<"appcontainer",
159                       "Image can only be run in an app container",
160                       "Image can run outside an app container (default)">;
161 defm cetcompat : B<"cetcompat", "Mark executable image as compatible with Control-flow Enforcement Technology (CET) Shadow Stack",
162                    "Don't mark executable image as compatible with Control-flow Enforcement Technology (CET) Shadow Stack (default)">;
163 defm dynamicbase : B<"dynamicbase", "Enable ASLR (default unless /fixed)",
164                      "Disable ASLR (default when /fixed)">;
165 defm fixed : B<"fixed", "Disable base relocations",
166                "Enable base relocations (default)">;
167 defm highentropyva : B<"highentropyva",
168                        "Enable 64-bit ASLR (default on 64-bit)",
169                        "Disable 64-bit ASLR">;
170 defm incremental : B<"incremental",
171                      "Keep original import library if contents are unchanged",
172                      "Overwrite import library even if contents are unchanged">;
173 defm integritycheck : B<"integritycheck",
174                         "Set FORCE_INTEGRITY bit in PE header",
175                         "No effect (default)">;
176 defm largeaddressaware : B<"largeaddressaware",
177                            "Enable large addresses (default on 64-bit)",
178                            "Disable large addresses (default on 32-bit)">;
179 defm nxcompat : B<"nxcompat", "Enable data execution prevention (default)",
180                   "Disable data execution provention">;
181 defm safeseh : B<"safeseh",
182                  "Produce an image with Safe Exception Handler (only for x86)",
183                  "Don't produce an image with Safe Exception Handler">;
184 defm tsaware  : B<"tsaware",
185                   "Create Terminal Server aware executable (default)",
186                   "Create non-Terminal Server aware executable">;
187
188 def help : F<"help">;
189
190 // /?? and -?? must be before /? and -? to not confuse lib/Options.
191 def help_q : Flag<["/??", "-??", "/?", "-?"], "">, Alias<help>;
192
193 // LLD extensions
194 defm auto_import : B_priv<"auto-import">;
195 defm runtime_pseudo_reloc : B_priv<"runtime-pseudo-reloc">;
196 def end_lib : F<"end-lib">,
197   HelpText<"Ends group of objects treated as if they were in a library">;
198 def exclude_all_symbols : F<"exclude-all-symbols">;
199 def export_all_symbols : F<"export-all-symbols">;
200 defm demangle : B<"demangle",
201     "Demangle symbols in output (default)",
202     "Do not demangle symbols in output">;
203 def include_optional : Joined<["/", "-", "/?", "-?"], "includeoptional:">,
204     HelpText<"Add symbol as undefined, but allow it to remain undefined">;
205 def kill_at : F<"kill-at">;
206 def lldmingw : F<"lldmingw">;
207 def noseh : F<"noseh">;
208 def output_def : Joined<["/", "-", "/?", "-?"], "output-def:">;
209 def pdb_source_path : P<"pdbsourcepath",
210     "Base path used to make relative source file path absolute in PDB">;
211 def rsp_quoting : Joined<["--"], "rsp-quoting=">,
212   HelpText<"Quoting style for response files, 'windows' (default) or 'posix'">;
213 def start_lib : F<"start-lib">,
214   HelpText<"Starts group of objects treated as if they were in a library">;
215 def thinlto_emit_imports_files :
216     F<"thinlto-emit-imports-files">,
217     HelpText<"Emit .imports files with -thinlto-index-only">;
218 def thinlto_index_only :
219     F<"thinlto-index-only">,
220     HelpText<"Instead of linking, emit ThinLTO index files">;
221 def thinlto_index_only_arg : P<
222     "thinlto-index-only",
223     "-thinlto-index-only and also write native module names to file">;
224 def thinlto_object_suffix_replace : P<
225     "thinlto-object-suffix-replace",
226     "'old;new' replace old suffix with new suffix in ThinLTO index">;
227 def thinlto_prefix_replace: P<
228     "thinlto-prefix-replace",
229     "'old;new' replace old prefix with new prefix in ThinLTO outputs">;
230 def lto_obj_path : P<
231     "lto-obj-path",
232     "output native object for merged LTO unit to this path">;
233 def dash_dash_version : Flag<["--"], "version">,
234   HelpText<"Print version information">;
235 def threads
236     : P<"threads", "Number of threads. '1' disables multi-threading. By "
237                    "default all available hardware threads are used">;
238
239 // Flags for debugging
240 def lldmap : F<"lldmap">;
241 def lldmap_file : Joined<["/", "-", "/?", "-?"], "lldmap:">;
242 def map : F<"map">;
243 def map_file : Joined<["/", "-", "/?", "-?"], "map:">;
244 def show_timing : F<"time">;
245 def summary : F<"summary">;
246
247 //==============================================================================
248 // The flags below do nothing. They are defined only for link.exe compatibility.
249 //==============================================================================
250
251 class QF<string name> : Joined<["/", "-", "/?", "-?"], name#":">;
252
253 def ignoreidl : F<"ignoreidl">;
254 def nologo : F<"nologo">;
255 def throwingnew : F<"throwingnew">;
256 def editandcontinue : F<"editandcontinue">;
257 def fastfail : F<"fastfail">;
258
259 def delay : QF<"delay">;
260 def errorreport : QF<"errorreport">;
261 def idlout : QF<"idlout">;
262 def maxilksize : QF<"maxilksize">;
263 def tlbid : QF<"tlbid">;
264 def tlbout : QF<"tlbout">;
265 def verbose_all : QF<"verbose">;
266 def guardsym : QF<"guardsym">;