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