1include "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. 6class F<string name> : Flag<["/", "-", "/?", "-?"], name>; 7 8// Flag that takes one argument after ":". 9class P<string name, string help> : 10 Joined<["/", "-", "/?", "-?"], name#":">, HelpText<help>; 11 12// Same as P<> above, but without help texts, for private undocumented 13// options. 14class P_priv<string name> : 15 Joined<["/", "-", "/?", "-?"], name#":">; 16 17// Boolean flag which can be suffixed by ":no". Using it unsuffixed turns the 18// flag on and using it suffixed by ":no" turns it off. 19multiclass B<string name, string help_on, string help_off> { 20 def "" : F<name>, HelpText<help_on>; 21 def _no : F<name#":no">, HelpText<help_off>; 22} 23 24// Same as B<> above, but without help texts, for private undocumented 25// options. 26multiclass B_priv<string name> { 27 def "" : F<name>; 28 def _no : F<name#":no">; 29} 30 31def align : P<"align", "Section alignment">; 32def aligncomm : P<"aligncomm", "Set common symbol alignment">; 33def alternatename : P<"alternatename", "Define weak alias">; 34def base : P<"base", "Base address of the program">; 35def color_diagnostics: Flag<["--"], "color-diagnostics">, 36 HelpText<"Alias for --color-diagnostics=always">; 37def no_color_diagnostics: Flag<["--"], "no-color-diagnostics">, 38 HelpText<"Alias for --color-diagnostics=never">; 39def color_diagnostics_eq: Joined<["--"], "color-diagnostics=">, 40 HelpText<"Use colors in diagnostics (default: auto)">, 41 MetaVarName<"[auto,always,never]">; 42def defaultlib : P<"defaultlib", "Add the library to the list of input files">; 43def delayload : P<"delayload", "Delay loaded DLL name">; 44def diasdkdir : P<"diasdkdir", "Set the location of the DIA SDK">; 45def dwodir : P<"dwodir", 46 "Directory to store .dwo files when LTO and debug fission are used">; 47def entry : P<"entry", "Name of entry point symbol">; 48def errorlimit : P<"errorlimit", 49 "Maximum number of errors to emit before stopping (0 = no limit)">; 50def exclude_symbols : P<"exclude-symbols", "Exclude symbols from automatic export">, 51 MetaVarName<"<symbol[,symbol,...]>">; 52def export : P<"export", "Export a function">; 53// No help text because /failifmismatch is not intended to be used by the user. 54def failifmismatch : P<"failifmismatch", "">; 55def filealign : P<"filealign", "Section alignment in the output file">; 56def functionpadmin : F<"functionpadmin">; 57def functionpadmin_opt : P<"functionpadmin", 58 "Prepares an image for hotpatching">; 59def dependentloadflag : F<"dependentloadflag">; 60def dependentloadflag_opt : P<"dependentloadflag", 61 "Sets the default load flags used to resolve the statically linked imports of a module">; 62def guard : P<"guard", "Control flow guard">; 63def heap : P<"heap", "Size of the heap">; 64def ignore : P<"ignore", "Specify warning codes to ignore">; 65def implib : P<"implib", "Import library name">; 66def noimplib : F<"noimplib">, 67 HelpText<"Don't output an import lib">; 68def lib : F<"lib">, 69 HelpText<"Act like lib.exe; must be first argument if present">; 70def libpath : P<"libpath", "Additional library search path">; 71def linkrepro : Joined<["/", "-", "/?", "-?"], "linkrepro:">, 72 MetaVarName<"directory">, 73 HelpText<"Write repro.tar containing inputs and command to reproduce link">; 74def lldignoreenv : F<"lldignoreenv">, 75 HelpText<"Ignore environment variables like %LIB%">; 76def lldltocache : P<"lldltocache", 77 "Path to ThinLTO cached object file directory">; 78def lldltocachepolicy : P<"lldltocachepolicy", 79 "Pruning policy for the ThinLTO cache">; 80def lldsavetemps : F<"lldsavetemps">, 81 HelpText<"Save intermediate LTO compilation results">; 82def lto_sample_profile: P<"lto-sample-profile", "Sample profile file path">; 83def machine : P<"machine", "Specify target platform">; 84def merge : P<"merge", "Combine sections">; 85def mllvm : P<"mllvm", "Options to pass to LLVM">; 86def nodefaultlib : P<"nodefaultlib", "Remove a default library">; 87def opt : P<"opt", "Control optimizations">; 88def order : P<"order", "Put functions in order">; 89def out : P<"out", "Path to file to write output">; 90def natvis : P<"natvis", "Path to natvis file to embed in the PDB">; 91def pdb : P<"pdb", "PDB file path">; 92def pdbaltpath : P<"pdbaltpath", "PDB file path to embed in the image">; 93def pdbpagesize : P<"pdbpagesize", "PDB page size">; 94def pdbstripped : P<"pdbstripped", "Stripped PDB file path">; 95def pdbstream : Joined<["/", "-", "/?", "-?"], "pdbstream:">, 96 MetaVarName<"<name>=<file>">, 97 HelpText<"Embed the contents of <file> in the PDB as named stream <name>">; 98def section : P<"section", "Specify section attributes">; 99def stack : P<"stack", "Size of the stack">; 100def stub : P<"stub", "Specify DOS stub file">; 101def subsystem : P<"subsystem", "Specify subsystem">; 102def timestamp : P<"timestamp", "Specify the PE header timestamp">; 103def vctoolsdir : P<"vctoolsdir", "Set the location of the VC tools">; 104def vctoolsversion : P<"vctoolsversion", 105 "Specify which VC tools version to use">; 106def version : P<"version", "Specify a version number in the PE header">; 107def wholearchive_file : P<"wholearchive", 108 "Include all object files from this library">; 109def winsdkdir : P<"winsdkdir", "Set the location of the Windows SDK">; 110def winsdkversion : P<"winsdkversion", "Specify which SDK version to use">; 111def winsysroot : P<"winsysroot", 112 "Adds several subdirectories to the library search paths">; 113 114def disallowlib : Joined<["/", "-", "/?", "-?"], "disallowlib:">, 115 Alias<nodefaultlib>; 116 117def manifest : F<"manifest">, HelpText<"Create .manifest file">; 118def manifest_colon : P< 119 "manifest", 120 "NO disables manifest output; EMBED[,ID=#] embeds manifest as resource in the image">; 121def manifestuac : P<"manifestuac", "User access control">; 122def manifestfile : P<"manifestfile", "Manifest output path, with /manifest">; 123def manifestdependency : P< 124 "manifestdependency", 125 "Attributes for <dependency> element in manifest file; implies /manifest">; 126def manifestinput : P< 127 "manifestinput", 128 "Additional manifest inputs; only valid with /manifest:embed">; 129 130// We cannot use multiclass P because class name "incl" is different 131// from its command line option name. We do this because "include" is 132// a reserved keyword in tablegen. 133def incl : Joined<["/", "-", "/?", "-?"], "include:">, 134 HelpText<"Force symbol to be added to symbol table as undefined one">; 135 136// "def" is also a keyword. 137def deffile : Joined<["/", "-", "/?", "-?"], "def:">, 138 HelpText<"Use module-definition file">; 139 140def debug : F<"debug">, HelpText<"Embed a symbol table in the image">; 141def debug_opt : P<"debug", "Embed a symbol table in the image with option">; 142def debugtype : P<"debugtype", "Debug Info Options">; 143def dll : F<"dll">, HelpText<"Create a DLL">; 144def driver : F<"driver">, HelpText<"Generate a Windows NT Kernel Mode Driver">; 145def driver_wdm : F<"driver:wdm">, 146 HelpText<"Set IMAGE_FILE_UP_SYSTEM_ONLY bit in PE header">; 147def driver_uponly : F<"driver:uponly">, 148 HelpText<"Set IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER bit in PE header">; 149def driver_wdm_uponly : F<"driver:wdm,uponly">; 150def driver_uponly_wdm : F<"driver:uponly,wdm">; 151def nodefaultlib_all : F<"nodefaultlib">, 152 HelpText<"Remove all default libraries">; 153def noentry : F<"noentry">, 154 HelpText<"Don't add reference to DllMainCRTStartup; only valid with /dll">; 155def profile : F<"profile">; 156def repro : F<"Brepro">, 157 HelpText<"Use a hash of the executable as the PE header timestamp">; 158def reproduce : Joined<["/", "-", "/?", "-?"], "reproduce:">, 159 MetaVarName<"filename">, 160 HelpText<"Write tar file containing inputs and command to reproduce link">; 161def swaprun : P<"swaprun", 162 "Comma-separated list of 'cd' or 'net'">; 163def swaprun_cd : F<"swaprun:cd">, Alias<swaprun>, AliasArgs<["cd"]>, 164 HelpText<"Make loader run output binary from swap instead of from CD">; 165def swaprun_net : F<"swaprun:net">, Alias<swaprun>, AliasArgs<["net"]>, 166 HelpText<"Make loader run output binary from swap instead of from network">; 167def verbose : F<"verbose">; 168def wholearchive_flag : F<"wholearchive">, 169 HelpText<"Include all object files from all libraries">; 170def release : F<"release">, 171 HelpText<"Set the Checksum in the header of an PE file">; 172 173def force : F<"force">, 174 HelpText<"Allow undefined and multiply defined symbols">; 175def force_unresolved : F<"force:unresolved">, 176 HelpText<"Allow undefined symbols when creating executables">; 177def force_multiple : F<"force:multiple">, 178 HelpText<"Allow multiply defined symbols when creating executables">; 179def force_multipleres : F<"force:multipleres">, 180 HelpText<"Allow multiply defined resources when creating executables">; 181defm WX : B<"WX", "Treat warnings as errors", 182 "Don't treat warnings as errors (default)">; 183 184defm allowbind : B<"allowbind", "Enable DLL binding (default)", 185 "Disable DLL binding">; 186defm allowisolation : B<"allowisolation", "Enable DLL isolation (default)", 187 "Disable DLL isolation">; 188defm appcontainer : B<"appcontainer", 189 "Image can only be run in an app container", 190 "Image can run outside an app container (default)">; 191defm cetcompat : B<"cetcompat", "Mark executable image as compatible with Control-flow Enforcement Technology (CET) Shadow Stack", 192 "Don't mark executable image as compatible with Control-flow Enforcement Technology (CET) Shadow Stack (default)">; 193defm dynamicbase : B<"dynamicbase", "Enable ASLR (default unless /fixed)", 194 "Disable ASLR (default when /fixed)">; 195defm fixed : B<"fixed", "Disable base relocations", 196 "Enable base relocations (default)">; 197defm highentropyva : B<"highentropyva", 198 "Enable 64-bit ASLR (default on 64-bit)", 199 "Disable 64-bit ASLR">; 200defm incremental : B<"incremental", 201 "Keep original import library if contents are unchanged", 202 "Overwrite import library even if contents are unchanged">; 203defm inferasanlibs : B<"inferasanlibs", 204 "Unused, generates a warning", 205 "No effect (default)">; 206defm integritycheck : B<"integritycheck", 207 "Set FORCE_INTEGRITY bit in PE header", 208 "No effect (default)">; 209defm largeaddressaware : B<"largeaddressaware", 210 "Enable large addresses (default on 64-bit)", 211 "Disable large addresses (default on 32-bit)">; 212defm nxcompat : B<"nxcompat", "Enable data execution prevention (default)", 213 "Disable data execution provention">; 214defm safeseh : B<"safeseh", 215 "Produce an image with Safe Exception Handler (only for x86)", 216 "Don't produce an image with Safe Exception Handler">; 217defm tsaware : B<"tsaware", 218 "Create Terminal Server aware executable (default)", 219 "Create non-Terminal Server aware executable">; 220 221def help : F<"help">; 222 223// /?? and -?? must be before /? and -? to not confuse lib/Options. 224def help_q : Flag<["/??", "-??", "/?", "-?"], "">, Alias<help>; 225 226// LLD extensions 227defm auto_import : B_priv<"auto-import">; 228defm runtime_pseudo_reloc : B_priv<"runtime-pseudo-reloc">; 229def end_lib : F<"end-lib">, 230 HelpText<"End group of objects treated as if they were in a library">; 231def exclude_all_symbols : F<"exclude-all-symbols">; 232def export_all_symbols : F<"export-all-symbols">; 233defm demangle : B<"demangle", 234 "Demangle symbols in output (default)", 235 "Do not demangle symbols in output">; 236def include_optional : Joined<["/", "-", "/?", "-?"], "includeoptional:">, 237 HelpText<"Add symbol as undefined, but allow it to remain undefined">; 238def kill_at : F<"kill-at">; 239defm lld_allow_duplicate_weak : B_priv<"lld-allow-duplicate-weak">; 240def lldemit : P<"lldemit", "Specify output type">; 241def lldmingw : F<"lldmingw">; 242def noseh : F<"noseh">; 243def osversion : P_priv<"osversion">; 244def output_def : Joined<["/", "-", "/?", "-?"], "output-def:">; 245def pdb_source_path : P<"pdbsourcepath", 246 "Base path used to make relative source file path absolute in PDB">; 247def rsp_quoting : Joined<["--"], "rsp-quoting=">, 248 HelpText<"Quoting style for response files, 'windows' (default) or 'posix'">; 249def start_lib : F<"start-lib">, 250 HelpText<"Start group of objects treated as if they were in a library">; 251defm stdcall_fixup : B_priv<"stdcall-fixup">; 252def thinlto_emit_imports_files : 253 F<"thinlto-emit-imports-files">, 254 HelpText<"Emit .imports files with -thinlto-index-only">; 255def thinlto_index_only : 256 F<"thinlto-index-only">, 257 HelpText<"Instead of linking, emit ThinLTO index files">; 258def thinlto_index_only_arg : P< 259 "thinlto-index-only", 260 "-thinlto-index-only and also write native module names to file">; 261def thinlto_object_suffix_replace : P< 262 "thinlto-object-suffix-replace", 263 "'old;new' replace old suffix with new suffix in ThinLTO index">; 264def thinlto_prefix_replace: P< 265 "thinlto-prefix-replace", 266 "'old;new' replace old prefix with new prefix in ThinLTO outputs">; 267def lto_obj_path : P< 268 "lto-obj-path", 269 "output native object for merged LTO unit to this path">; 270def lto_cs_profile_generate: F<"lto-cs-profile-generate">, 271 HelpText<"Perform context sensitive PGO instrumentation">; 272def lto_cs_profile_file : P<"lto-cs-profile-file", 273 "Context sensitive profile file path">; 274defm lto_pgo_warn_mismatch: B< 275 "lto-pgo-warn-mismatch", 276 "turn on warnings about profile cfg mismatch (default)>", 277 "turn off warnings about profile cfg mismatch">; 278def dash_dash_version : Flag<["--"], "version">, 279 HelpText<"Display the version number and exit">; 280def threads 281 : P<"threads", "Number of threads. '1' disables multi-threading. By " 282 "default all available hardware threads are used">; 283def call_graph_ordering_file: P< 284 "call-graph-ordering-file", 285 "Layout sections to optimize the given callgraph">; 286defm call_graph_profile_sort: B< 287 "call-graph-profile-sort", 288 "Reorder sections with call graph profile (default)", 289 "Do not reorder sections with call graph profile">; 290def print_symbol_order: P< 291 "print-symbol-order", 292 "Print a symbol order specified by /call-graph-ordering-file and " 293 "/call-graph-profile-sort into the specified file">; 294def wrap : P_priv<"wrap">; 295 296def vfsoverlay : P<"vfsoverlay", "Path to a vfsoverlay yaml file to optionally look for /defaultlib's in">; 297 298def time_trace_eq: Joined<["--"], "time-trace=">, MetaVarName<"<file>">, 299 HelpText<"Record time trace to <file>">; 300def : Flag<["--"], "time-trace">, Alias<time_trace_eq>, 301 HelpText<"Record time trace to file next to output">; 302 303def time_trace_granularity_eq: Joined<["--"], "time-trace-granularity=">, 304 HelpText<"Minimum time granularity (in microseconds) traced by time profiler">; 305 306defm build_id: B< 307 "build-id", 308 "Generate build ID (always on when generating PDB)", 309 "Do not Generate build ID">; 310 311// Flags for debugging 312def lldmap : F<"lldmap">; 313def lldmap_file : P_priv<"lldmap">; 314def map : F<"map">; 315def map_file : P_priv<"map">; 316def map_info : P<"mapinfo", "Include the specified information in a map file">; 317def print_search_paths : F<"print-search-paths">; 318def show_timing : F<"time">; 319def summary : F<"summary">; 320 321//============================================================================== 322// The flags below do nothing. They are defined only for link.exe compatibility. 323//============================================================================== 324 325def ignoreidl : F<"ignoreidl">; 326def ltcg : F<"ltcg">; 327def assemblydebug : F<"assemblydebug">; 328def nologo : F<"nologo">; 329def throwingnew : F<"throwingnew">; 330def editandcontinue : F<"editandcontinue">; 331def fastfail : F<"fastfail">; 332def kernel : F<"kernel">; 333def pdbcompress : F<"pdbcompress">; 334def emitpogophaseinfo : F<"emitpogophaseinfo">; 335 336def delay : P_priv<"delay">; 337def errorreport : P_priv<"errorreport">; 338def idlout : P_priv<"idlout">; 339def ilk : P_priv<"ilk">; 340def ltcg_opt : P_priv<"ltcg">; 341def assemblydebug_opt : P_priv<"assemblydebug">; 342def ltcgout : P_priv<"ltcgout">; 343def maxilksize : P_priv<"maxilksize">; 344def tlbid : P_priv<"tlbid">; 345def tlbout : P_priv<"tlbout">; 346def verbose_all : P_priv<"verbose">; 347def guardsym : P_priv<"guardsym">; 348