1 include "llvm/Option/OptParser.td"
3 // link.exe accepts options starting with either a dash or a slash.
5 // Flag that takes no arguments.
6 class F<string name> : Flag<["/", "-", "-?"], name>;
8 // Flag that takes one argument after ":".
9 class P<string name, string help> :
10 Joined<["/", "-", "-?"], name#":">, HelpText<help>;
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>;
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 guard : P<"guard", "Control flow guard">;
36 def heap : P<"heap", "Size of the heap">;
37 def ignore : P<"ignore", "Specify warning codes to ignore">;
38 def implib : P<"implib", "Import library name">;
40 HelpText<"Act like lib.exe; must be first argument if present">;
41 def libpath : P<"libpath", "Additional library search path">;
42 def linkrepro : P<"linkrepro", "Dump linker invocation and input files for debugging">;
43 def lldltocache : P<"lldltocache", "Path to ThinLTO cached object file directory">;
44 def lldltocachepolicy : P<"lldltocachepolicy", "Pruning policy for the ThinLTO cache">;
45 def lldsavetemps : F<"lldsavetemps">,
46 HelpText<"Save temporary files instead of deleting them">;
47 def machine : P<"machine", "Specify target platform">;
48 def merge : P<"merge", "Combine sections">;
49 def mllvm : P<"mllvm", "Options to pass to LLVM">;
50 def nodefaultlib : P<"nodefaultlib", "Remove a default library">;
51 def opt : P<"opt", "Control optimizations">;
52 def order : P<"order", "Put functions in order">;
53 def out : P<"out", "Path to file to write output">;
54 def natvis : P<"natvis", "Path to natvis file to embed in the PDB">;
55 def no_color_diagnostics: F<"no-color-diagnostics">,
56 HelpText<"Do not use colors in diagnostics">;
57 def pdb : P<"pdb", "PDB file path">;
58 def pdbaltpath : P<"pdbaltpath", "PDB file path to embed in the image">;
59 def section : P<"section", "Specify section attributes">;
60 def stack : P<"stack", "Size of the stack">;
61 def stub : P<"stub", "Specify DOS stub file">;
62 def subsystem : P<"subsystem", "Specify subsystem">;
63 def timestamp : P<"timestamp", "Specify the PE header timestamp">;
64 def version : P<"version", "Specify a version number in the PE header">;
65 def wholearchive_file : P<"wholearchive", "Include all object files from this archive">;
67 def disallowlib : Joined<["/", "-", "-?"], "disallowlib:">, Alias<nodefaultlib>;
69 def manifest : F<"manifest">, HelpText<"Create .manifest file">;
70 def manifest_colon : P<
72 "NO disables manifest output; EMBED[,ID=#] embeds manifest as resource in the image">;
73 def manifestuac : P<"manifestuac", "User access control">;
74 def manifestfile : P<"manifestfile", "Manifest output path, with /manifest">;
75 def manifestdependency : P<
77 "Attributes for <dependency> element in manifest file; implies /manifest">;
78 def manifestinput : P<
80 "Additional manifest inputs; only valid with /manifest:embed">;
82 // We cannot use multiclass P because class name "incl" is different
83 // from its command line option name. We do this because "include" is
84 // a reserved keyword in tablegen.
85 def incl : Joined<["/", "-"], "include:">,
86 HelpText<"Force symbol to be added to symbol table as undefined one">;
88 // "def" is also a keyword.
89 def deffile : Joined<["/", "-"], "def:">,
90 HelpText<"Use module-definition file">;
92 def debug : F<"debug">, HelpText<"Embed a symbol table in the image">;
93 def debug_opt : P<"debug", "Embed a symbol table in the image with option">;
94 def debugtype : P<"debugtype", "Debug Info Options">;
95 def dll : F<"dll">, HelpText<"Create a DLL">;
96 def driver : P<"driver", "Generate a Windows NT Kernel Mode Driver">;
97 def nodefaultlib_all : F<"nodefaultlib">,
98 HelpText<"Remove all default libraries">;
99 def noentry : F<"noentry">,
100 HelpText<"Don't add reference to DllMainCRTStartup; only valid with /dll">;
101 def profile : F<"profile">;
102 def repro : F<"Brepro">,
103 HelpText<"Use a hash of the executable as the PE header timestamp">;
104 def swaprun_cd : F<"swaprun:cd">;
105 def swaprun_net : F<"swaprun:net">;
106 def verbose : F<"verbose">;
107 def wholearchive_flag : F<"wholearchive">;
109 def force : F<"force">,
110 HelpText<"Allow undefined and multiply defined symbols when creating executables">;
111 def force_unresolved : F<"force:unresolved">,
112 HelpText<"Allow undefined symbols when creating executables">;
113 def force_multiple : F<"force:multiple">,
114 HelpText<"Allow multiply defined symbols when creating executables">;
115 defm WX : B<"WX", "Treat warnings as errors", "Don't treat warnings as errors">;
117 defm allowbind : B<"allowbind", "Enable DLL binding (default)",
118 "Disable DLL binding">;
119 defm allowisolation : B<"allowisolation", "Enable DLL isolation (default)",
120 "Disable DLL isolation">;
121 defm appcontainer : B<"appcontainer",
122 "Image can only be run in an app container",
123 "Image can run outside an app container (default)">;
124 defm dynamicbase : B<"dynamicbase", "Enable ASLR (default unless /fixed)",
125 "Disable ASLR (default when /fixed)">;
126 defm fixed : B<"fixed", "Disable base relocations",
127 "Enable base relocations (default)">;
128 defm highentropyva : B<"highentropyva",
129 "Enable 64-bit ASLR (default on 64-bit)",
130 "Disable 64-bit ASLR">;
131 defm incremental : B<"incremental",
132 "Keep original import library if contents are unchanged",
133 "Overwrite import library even if contents are unchanged">;
134 defm integritycheck : B<"integritycheck",
135 "Set FORCE_INTEGRITY bit in PE header",
136 "No effect (default)">;
137 defm largeaddressaware : B<"largeaddressaware",
138 "Enable large addresses (default on 64-bit)",
139 "Disable large addresses (default on 32-bit)">;
140 defm nxcompat : B<"nxcompat", "Enable data execution prevention (default)",
141 "Disable data execution provention">;
142 defm safeseh : B<"safeseh",
143 "Produce an image with Safe Exception Handler (only for x86)",
144 "Don't produce an image with Safe Exception Handler">;
145 defm tsaware : B<"tsaware",
146 "Create Terminal Server aware executable (default)",
147 "Create non-Terminal Server aware executable">;
149 def help : F<"help">;
150 def help_q : Flag<["/?", "-?"], "">, Alias<help>;
153 def export_all_symbols : F<"export-all-symbols">;
154 def kill_at : F<"kill-at">;
155 def lldmingw : F<"lldmingw">;
156 def output_def : Joined<["/", "-"], "output-def:">;
157 def pdb_source_path : P<"pdbsourcepath",
158 "Base path used to make relative source file path absolute in PDB">;
159 def rsp_quoting : Joined<["--"], "rsp-quoting=">,
160 HelpText<"Quoting style for response files, 'windows' (default) or 'posix'">;
161 def dash_dash_version : Flag<["--"], "version">,
162 HelpText<"Print version information">;
164 // Flags for debugging
165 def lldmap : F<"lldmap">;
166 def lldmap_file : Joined<["/", "-"], "lldmap:">;
167 def show_timing : F<"time">;
169 //==============================================================================
170 // The flags below do nothing. They are defined only for link.exe compatibility.
171 //==============================================================================
173 class QF<string name> : Joined<["/", "-", "-?"], name#":">;
175 multiclass QB<string name> {
177 def _no : F<name#":no">;
180 def functionpadmin : F<"functionpadmin">;
181 def ignoreidl : F<"ignoreidl">;
182 def nologo : F<"nologo">;
183 def throwingnew : F<"throwingnew">;
184 def editandcontinue : F<"editandcontinue">;
185 def fastfail : F<"fastfail">;
187 def delay : QF<"delay">;
188 def errorreport : QF<"errorreport">;
189 def idlout : QF<"idlout">;
190 def maxilksize : QF<"maxilksize">;
191 def tlbid : QF<"tlbid">;
192 def tlbout : QF<"tlbout">;
193 def verbose_all : QF<"verbose">;
194 def guardsym : QF<"guardsym">;