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 defaultlib : P<"defaultlib", "Add the library to the list of input files">;
24 def delayload : P<"delayload", "Delay loaded DLL name">;
25 def entry : P<"entry", "Name of entry point symbol">;
26 def errorlimit : P<"errorlimit",
27 "Maximum number of errors to emit before stopping (0 = no limit)">;
28 def export : P<"export", "Export a function">;
29 // No help text because /failifmismatch is not intended to be used by the user.
30 def failifmismatch : P<"failifmismatch", "">;
31 def heap : P<"heap", "Size of the heap">;
32 def ignore : P<"ignore", "Specify warning codes to ignore">;
33 def implib : P<"implib", "Import library name">;
34 def libpath : P<"libpath", "Additional library search path">;
35 def linkrepro : P<"linkrepro", "Dump linker invocation and input files for debugging">;
36 def lldltocache : P<"lldltocache", "Path to ThinLTO cached object file directory">;
37 def lldltocachepolicy : P<"lldltocachepolicy", "Pruning policy for the ThinLTO cache">;
38 def lldsavetemps : F<"lldsavetemps">,
39 HelpText<"Save temporary files instead of deleting them">;
40 def machine : P<"machine", "Specify target platform">;
41 def merge : P<"merge", "Combine sections">;
42 def mllvm : P<"mllvm", "Options to pass to LLVM">;
43 def nodefaultlib : P<"nodefaultlib", "Remove a default library">;
44 def opt : P<"opt", "Control optimizations">;
45 def out : P<"out", "Path to file to write output">;
46 def pdb : P<"pdb", "PDB file path">;
47 def section : P<"section", "Specify section attributes">;
48 def stack : P<"stack", "Size of the stack">;
49 def stub : P<"stub", "Specify DOS stub file">;
50 def subsystem : P<"subsystem", "Specify subsystem">;
51 def version : P<"version", "Specify a version number in the PE header">;
52 def wholearchive_file : P<"wholearchive", "Include all object files from this archive">;
54 def disallowlib : Joined<["/", "-", "-?"], "disallowlib:">, Alias<nodefaultlib>;
56 def manifest : F<"manifest">;
57 def manifest_colon : P<"manifest", "Create manifest file">;
58 def manifestuac : P<"manifestuac", "User access control">;
59 def manifestfile : P<"manifestfile", "Manifest file path">;
60 def manifestdependency : P<"manifestdependency",
61 "Attributes for <dependency> in manifest file">;
62 def manifestinput : P<"manifestinput", "Specify manifest file">;
64 // We cannot use multiclass P because class name "incl" is different
65 // from its command line option name. We do this because "include" is
66 // a reserved keyword in tablegen.
67 def incl : Joined<["/", "-"], "include:">,
68 HelpText<"Force symbol to be added to symbol table as undefined one">;
70 // "def" is also a keyword.
71 def deffile : Joined<["/", "-"], "def:">,
72 HelpText<"Use module-definition file">;
74 def debug : F<"debug">, HelpText<"Embed a symbol table in the image">;
75 def debugtype : P<"debugtype", "Debug Info Options">;
76 def dll : F<"dll">, HelpText<"Create a DLL">;
77 def driver : P<"driver", "Generate a Windows NT Kernel Mode Driver">;
78 def nodefaultlib_all : F<"nodefaultlib">;
79 def noentry : F<"noentry">;
80 def profile : F<"profile">;
81 def swaprun_cd : F<"swaprun:cd">;
82 def swaprun_net : F<"swaprun:net">;
83 def verbose : F<"verbose">;
84 def wholearchive_flag : F<"wholearchive">;
86 def force : F<"force">,
87 HelpText<"Allow undefined symbols when creating executables">;
88 def force_unresolved : F<"force:unresolved">;
89 defm WX : B<"WX", "Treat warnings as errors", "Don't treat warnings as errors">;
91 defm allowbind : B<"allowbind", "Enable DLL binding (default)",
92 "Disable DLL binding">;
93 defm allowisolation : B<"allowisolation", "Enable DLL isolation (default)",
94 "Disable DLL isolation">;
95 defm appcontainer : B<"appcontainer",
96 "Image can only be run in an app container",
97 "Image can run outside an app container (default)">;
98 defm dynamicbase : B<"dynamicbase", "Enable ASLR (default unless /fixed)",
99 "Disable ASLR (default when /fixed)">;
100 defm fixed : B<"fixed", "Disable base relocations",
101 "Enable base relocations (default)">;
102 defm highentropyva : B<"highentropyva",
103 "Enable 64-bit ASLR (default on 64-bit)",
104 "Disable 64-bit ASLR">;
105 defm largeaddressaware : B<"largeaddressaware",
106 "Enable large addresses (default on 64-bit)",
107 "Disable large addresses (default on 32-bit)">;
108 defm nxcompat : B<"nxcompat", "Enable data execution prevention (default)",
109 "Disable data execution provention">;
110 defm safeseh : B<"safeseh",
111 "Produce an image with Safe Exception Handler (only for x86)",
112 "Don't produce an image with Safe Exception Handler">;
113 defm tsaware : B<"tsaware",
114 "Create Terminal Server aware executable (default)",
115 "Create non-Terminal Server aware executable">;
117 def help : F<"help">;
118 def help_q : Flag<["/?", "-?"], "">, Alias<help>;
121 def debug_ghash : F<"debug:ghash">;
122 def debug_dwarf : F<"debug:dwarf">;
123 def export_all_symbols : F<"export-all-symbols">;
124 def kill_at : F<"kill-at">;
125 def lldmingw : F<"lldmingw">;
126 def msvclto : F<"msvclto">;
127 def output_def : Joined<["/", "-"], "output-def:">;
128 def rsp_quoting : Joined<["--"], "rsp-quoting=">,
129 HelpText<"Quoting style for response files, 'windows' (default) or 'posix'">;
130 def dash_dash_version : Flag<["--"], "version">,
131 HelpText<"Print version information">;
133 // Flags for debugging
134 def lldmap : F<"lldmap">;
135 def lldmap_file : Joined<["/", "-"], "lldmap:">;
137 //==============================================================================
138 // The flags below do nothing. They are defined only for link.exe compatibility.
139 //==============================================================================
141 class QF<string name> : Joined<["/", "-", "-?"], name#":">;
143 multiclass QB<string name> {
145 def _no : F<name#":no">;
148 def functionpadmin : F<"functionpadmin">;
149 def ignoreidl : F<"ignoreidl">;
150 def incremental : F<"incremental">;
151 def no_incremental : F<"incremental:no">;
152 def nologo : F<"nologo">;
153 def throwingnew : F<"throwingnew">;
154 def editandcontinue : F<"editandcontinue">;
155 def fastfail : F<"fastfail">;
157 def delay : QF<"delay">;
158 def errorreport : QF<"errorreport">;
159 def idlout : QF<"idlout">;
160 def maxilksize : QF<"maxilksize">;
161 def natvis : QF<"natvis">;
162 def pdbaltpath : QF<"pdbaltpath">;
163 def tlbid : QF<"tlbid">;
164 def tlbout : QF<"tlbout">;
165 def verbose_all : QF<"verbose">;
166 def guardsym : QF<"guardsym">;