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