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