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