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">;
70 def manifest_colon : P<"manifest", "Create manifest file">;
71 def manifestuac : P<"manifestuac", "User access control">;
72 def manifestfile : P<"manifestfile", "Manifest file path">;
73 def manifestdependency : P<"manifestdependency",
74 "Attributes for <dependency> in manifest file">;
75 def manifestinput : P<"manifestinput", "Specify manifest file">;
77 // We cannot use multiclass P because class name "incl" is different
78 // from its command line option name. We do this because "include" is
79 // a reserved keyword in tablegen.
80 def incl : Joined<["/", "-"], "include:">,
81 HelpText<"Force symbol to be added to symbol table as undefined one">;
83 // "def" is also a keyword.
84 def deffile : Joined<["/", "-"], "def:">,
85 HelpText<"Use module-definition file">;
87 def debug : F<"debug">, HelpText<"Embed a symbol table in the image">;
88 def debug_full : F<"debug:full">, Alias<debug>;
89 def debugtype : P<"debugtype", "Debug Info Options">;
90 def dll : F<"dll">, HelpText<"Create a DLL">;
91 def driver : P<"driver", "Generate a Windows NT Kernel Mode Driver">;
92 def nodefaultlib_all : F<"nodefaultlib">;
93 def noentry : F<"noentry">;
94 def profile : F<"profile">;
95 def repro : F<"Brepro">, HelpText<"Use a hash of the executable as the PE header timestamp">;
96 def swaprun_cd : F<"swaprun:cd">;
97 def swaprun_net : F<"swaprun:net">;
98 def verbose : F<"verbose">;
99 def wholearchive_flag : F<"wholearchive">;
101 def force : F<"force">,
102 HelpText<"Allow undefined symbols when creating executables">;
103 def force_unresolved : F<"force:unresolved">;
104 defm WX : B<"WX", "Treat warnings as errors", "Don't treat warnings as errors">;
106 defm allowbind : B<"allowbind", "Enable DLL binding (default)",
107 "Disable DLL binding">;
108 defm allowisolation : B<"allowisolation", "Enable DLL isolation (default)",
109 "Disable DLL isolation">;
110 defm appcontainer : B<"appcontainer",
111 "Image can only be run in an app container",
112 "Image can run outside an app container (default)">;
113 defm dynamicbase : B<"dynamicbase", "Enable ASLR (default unless /fixed)",
114 "Disable ASLR (default when /fixed)">;
115 defm fixed : B<"fixed", "Disable base relocations",
116 "Enable base relocations (default)">;
117 defm highentropyva : B<"highentropyva",
118 "Enable 64-bit ASLR (default on 64-bit)",
119 "Disable 64-bit ASLR">;
120 defm incremental : B<"incremental",
121 "Keep original import library if contents are unchanged",
122 "Overwrite import library even if contents are unchanged">;
123 defm integritycheck : B<"integritycheck",
124 "Set FORCE_INTEGRITY bit in PE header",
125 "No effect (default)">;
126 defm largeaddressaware : B<"largeaddressaware",
127 "Enable large addresses (default on 64-bit)",
128 "Disable large addresses (default on 32-bit)">;
129 defm nxcompat : B<"nxcompat", "Enable data execution prevention (default)",
130 "Disable data execution provention">;
131 defm safeseh : B<"safeseh",
132 "Produce an image with Safe Exception Handler (only for x86)",
133 "Don't produce an image with Safe Exception Handler">;
134 defm tsaware : B<"tsaware",
135 "Create Terminal Server aware executable (default)",
136 "Create non-Terminal Server aware executable">;
138 def help : F<"help">;
139 def help_q : Flag<["/?", "-?"], "">, Alias<help>;
142 def debug_ghash : F<"debug:ghash">;
143 def debug_dwarf : F<"debug:dwarf">;
144 def debug_symtab : F<"debug:symtab">;
145 def export_all_symbols : F<"export-all-symbols">;
146 def kill_at : F<"kill-at">;
147 def lldmingw : F<"lldmingw">;
148 def msvclto : F<"msvclto">;
149 def output_def : Joined<["/", "-"], "output-def:">;
150 def pdb_source_path : P<"pdbsourcepath",
151 "Base path used to make relative source file path absolute in PDB">;
152 def rsp_quoting : Joined<["--"], "rsp-quoting=">,
153 HelpText<"Quoting style for response files, 'windows' (default) or 'posix'">;
154 def dash_dash_version : Flag<["--"], "version">,
155 HelpText<"Print version information">;
157 // Flags for debugging
158 def lldmap : F<"lldmap">;
159 def lldmap_file : Joined<["/", "-"], "lldmap:">;
160 def show_timing : F<"time">;
162 //==============================================================================
163 // The flags below do nothing. They are defined only for link.exe compatibility.
164 //==============================================================================
166 class QF<string name> : Joined<["/", "-", "-?"], name#":">;
168 multiclass QB<string name> {
170 def _no : F<name#":no">;
173 def functionpadmin : F<"functionpadmin">;
174 def ignoreidl : F<"ignoreidl">;
175 def nologo : F<"nologo">;
176 def throwingnew : F<"throwingnew">;
177 def editandcontinue : F<"editandcontinue">;
178 def fastfail : F<"fastfail">;
180 def delay : QF<"delay">;
181 def errorreport : QF<"errorreport">;
182 def idlout : QF<"idlout">;
183 def maxilksize : QF<"maxilksize">;
184 def tlbid : QF<"tlbid">;
185 def tlbout : QF<"tlbout">;
186 def verbose_all : QF<"verbose">;
187 def guardsym : QF<"guardsym">;