10b57cec5SDimitry Andricinclude "llvm/Option/OptParser.td" 20b57cec5SDimitry Andric 30b57cec5SDimitry Andric// link.exe accepts options starting with either a dash or a slash. 40b57cec5SDimitry Andric 50b57cec5SDimitry Andric// Flag that takes no arguments. 60b57cec5SDimitry Andricclass F<string name> : Flag<["/", "-", "/?", "-?"], name>; 70b57cec5SDimitry Andric 80b57cec5SDimitry Andric// Flag that takes one argument after ":". 90b57cec5SDimitry Andricclass P<string name, string help> : 100b57cec5SDimitry Andric Joined<["/", "-", "/?", "-?"], name#":">, HelpText<help>; 110b57cec5SDimitry Andric 120b57cec5SDimitry Andric// Boolean flag which can be suffixed by ":no". Using it unsuffixed turns the 130b57cec5SDimitry Andric// flag on and using it suffixed by ":no" turns it off. 140b57cec5SDimitry Andricmulticlass B<string name, string help_on, string help_off> { 150b57cec5SDimitry Andric def "" : F<name>, HelpText<help_on>; 160b57cec5SDimitry Andric def _no : F<name#":no">, HelpText<help_off>; 170b57cec5SDimitry Andric} 180b57cec5SDimitry Andric 190b57cec5SDimitry Andricdef align : P<"align", "Section alignment">; 200b57cec5SDimitry Andricdef aligncomm : P<"aligncomm", "Set common symbol alignment">; 210b57cec5SDimitry Andricdef alternatename : P<"alternatename", "Define weak alias">; 220b57cec5SDimitry Andricdef base : P<"base", "Base address of the program">; 230b57cec5SDimitry Andricdef color_diagnostics: Flag<["--"], "color-diagnostics">, 240b57cec5SDimitry Andric HelpText<"Use colors in diagnostics">; 250b57cec5SDimitry Andricdef color_diagnostics_eq: Joined<["--"], "color-diagnostics=">, 260b57cec5SDimitry Andric HelpText<"Use colors in diagnostics; one of 'always', 'never', 'auto'">; 270b57cec5SDimitry Andricdef defaultlib : P<"defaultlib", "Add the library to the list of input files">; 280b57cec5SDimitry Andricdef delayload : P<"delayload", "Delay loaded DLL name">; 290b57cec5SDimitry Andricdef entry : P<"entry", "Name of entry point symbol">; 300b57cec5SDimitry Andricdef errorlimit : P<"errorlimit", 310b57cec5SDimitry Andric "Maximum number of errors to emit before stopping (0 = no limit)">; 320b57cec5SDimitry Andricdef export : P<"export", "Export a function">; 330b57cec5SDimitry Andric// No help text because /failifmismatch is not intended to be used by the user. 340b57cec5SDimitry Andricdef failifmismatch : P<"failifmismatch", "">; 350b57cec5SDimitry Andricdef filealign : P<"filealign", "Section alignment in the output file">; 360b57cec5SDimitry Andricdef functionpadmin : F<"functionpadmin">; 37*85868e8aSDimitry Andricdef functionpadmin_opt : P<"functionpadmin", 38*85868e8aSDimitry Andric "Prepares an image for hotpatching">; 390b57cec5SDimitry Andricdef guard : P<"guard", "Control flow guard">; 400b57cec5SDimitry Andricdef heap : P<"heap", "Size of the heap">; 410b57cec5SDimitry Andricdef ignore : P<"ignore", "Specify warning codes to ignore">; 420b57cec5SDimitry Andricdef implib : P<"implib", "Import library name">; 430b57cec5SDimitry Andricdef lib : F<"lib">, 440b57cec5SDimitry Andric HelpText<"Act like lib.exe; must be first argument if present">; 450b57cec5SDimitry Andricdef libpath : P<"libpath", "Additional library search path">; 46*85868e8aSDimitry Andricdef linkrepro : P<"linkrepro", 47*85868e8aSDimitry Andric "Dump linker invocation and input files for debugging">; 48*85868e8aSDimitry Andricdef lldignoreenv : F<"lldignoreenv">, 49*85868e8aSDimitry Andric HelpText<"Ignore environment variables like %LIB%">; 50*85868e8aSDimitry Andricdef lldltocache : P<"lldltocache", 51*85868e8aSDimitry Andric "Path to ThinLTO cached object file directory">; 52*85868e8aSDimitry Andricdef lldltocachepolicy : P<"lldltocachepolicy", 53*85868e8aSDimitry Andric "Pruning policy for the ThinLTO cache">; 540b57cec5SDimitry Andricdef lldsavetemps : F<"lldsavetemps">, 550b57cec5SDimitry Andric HelpText<"Save temporary files instead of deleting them">; 560b57cec5SDimitry Andricdef machine : P<"machine", "Specify target platform">; 570b57cec5SDimitry Andricdef merge : P<"merge", "Combine sections">; 580b57cec5SDimitry Andricdef mllvm : P<"mllvm", "Options to pass to LLVM">; 590b57cec5SDimitry Andricdef nodefaultlib : P<"nodefaultlib", "Remove a default library">; 600b57cec5SDimitry Andricdef opt : P<"opt", "Control optimizations">; 610b57cec5SDimitry Andricdef order : P<"order", "Put functions in order">; 620b57cec5SDimitry Andricdef out : P<"out", "Path to file to write output">; 630b57cec5SDimitry Andricdef natvis : P<"natvis", "Path to natvis file to embed in the PDB">; 640b57cec5SDimitry Andricdef no_color_diagnostics: F<"no-color-diagnostics">, 650b57cec5SDimitry Andric HelpText<"Do not use colors in diagnostics">; 660b57cec5SDimitry Andricdef pdb : P<"pdb", "PDB file path">; 670b57cec5SDimitry Andricdef pdbaltpath : P<"pdbaltpath", "PDB file path to embed in the image">; 680b57cec5SDimitry Andricdef section : P<"section", "Specify section attributes">; 690b57cec5SDimitry Andricdef stack : P<"stack", "Size of the stack">; 700b57cec5SDimitry Andricdef stub : P<"stub", "Specify DOS stub file">; 710b57cec5SDimitry Andricdef subsystem : P<"subsystem", "Specify subsystem">; 720b57cec5SDimitry Andricdef timestamp : P<"timestamp", "Specify the PE header timestamp">; 730b57cec5SDimitry Andricdef version : P<"version", "Specify a version number in the PE header">; 74*85868e8aSDimitry Andricdef wholearchive_file : P<"wholearchive", 75*85868e8aSDimitry Andric "Include all object files from this library">; 760b57cec5SDimitry Andric 770b57cec5SDimitry Andricdef disallowlib : Joined<["/", "-", "/?", "-?"], "disallowlib:">, 780b57cec5SDimitry Andric Alias<nodefaultlib>; 790b57cec5SDimitry Andric 800b57cec5SDimitry Andricdef manifest : F<"manifest">, HelpText<"Create .manifest file">; 810b57cec5SDimitry Andricdef manifest_colon : P< 820b57cec5SDimitry Andric "manifest", 830b57cec5SDimitry Andric "NO disables manifest output; EMBED[,ID=#] embeds manifest as resource in the image">; 840b57cec5SDimitry Andricdef manifestuac : P<"manifestuac", "User access control">; 850b57cec5SDimitry Andricdef manifestfile : P<"manifestfile", "Manifest output path, with /manifest">; 860b57cec5SDimitry Andricdef manifestdependency : P< 870b57cec5SDimitry Andric "manifestdependency", 880b57cec5SDimitry Andric "Attributes for <dependency> element in manifest file; implies /manifest">; 890b57cec5SDimitry Andricdef manifestinput : P< 900b57cec5SDimitry Andric "manifestinput", 910b57cec5SDimitry Andric "Additional manifest inputs; only valid with /manifest:embed">; 920b57cec5SDimitry Andric 930b57cec5SDimitry Andric// We cannot use multiclass P because class name "incl" is different 940b57cec5SDimitry Andric// from its command line option name. We do this because "include" is 950b57cec5SDimitry Andric// a reserved keyword in tablegen. 960b57cec5SDimitry Andricdef incl : Joined<["/", "-", "/?", "-?"], "include:">, 970b57cec5SDimitry Andric HelpText<"Force symbol to be added to symbol table as undefined one">; 980b57cec5SDimitry Andric 990b57cec5SDimitry Andric// "def" is also a keyword. 1000b57cec5SDimitry Andricdef deffile : Joined<["/", "-", "/?", "-?"], "def:">, 1010b57cec5SDimitry Andric HelpText<"Use module-definition file">; 1020b57cec5SDimitry Andric 1030b57cec5SDimitry Andricdef debug : F<"debug">, HelpText<"Embed a symbol table in the image">; 1040b57cec5SDimitry Andricdef debug_opt : P<"debug", "Embed a symbol table in the image with option">; 1050b57cec5SDimitry Andricdef debugtype : P<"debugtype", "Debug Info Options">; 1060b57cec5SDimitry Andricdef dll : F<"dll">, HelpText<"Create a DLL">; 1070b57cec5SDimitry Andricdef driver : P<"driver", "Generate a Windows NT Kernel Mode Driver">; 1080b57cec5SDimitry Andricdef nodefaultlib_all : F<"nodefaultlib">, 1090b57cec5SDimitry Andric HelpText<"Remove all default libraries">; 1100b57cec5SDimitry Andricdef noentry : F<"noentry">, 1110b57cec5SDimitry Andric HelpText<"Don't add reference to DllMainCRTStartup; only valid with /dll">; 1120b57cec5SDimitry Andricdef profile : F<"profile">; 1130b57cec5SDimitry Andricdef repro : F<"Brepro">, 1140b57cec5SDimitry Andric HelpText<"Use a hash of the executable as the PE header timestamp">; 115*85868e8aSDimitry Andricdef reproduce : P<"reproduce", 116*85868e8aSDimitry Andric "Dump linker invocation and input files for debugging">; 1170b57cec5SDimitry Andricdef swaprun : P<"swaprun", 1180b57cec5SDimitry Andric "Comma-separated list of 'cd' or 'net'">; 1190b57cec5SDimitry Andricdef swaprun_cd : F<"swaprun:cd">, Alias<swaprun>, AliasArgs<["cd"]>, 1200b57cec5SDimitry Andric HelpText<"Make loader run output binary from swap instead of from CD">; 1210b57cec5SDimitry Andricdef swaprun_net : F<"swaprun:net">, Alias<swaprun>, AliasArgs<["net"]>, 1220b57cec5SDimitry Andric HelpText<"Make loader run output binary from swap instead of from network">; 1230b57cec5SDimitry Andricdef verbose : F<"verbose">; 124*85868e8aSDimitry Andricdef wholearchive_flag : F<"wholearchive">, 125*85868e8aSDimitry Andric HelpText<"Include all object files from all libraries">; 1260b57cec5SDimitry Andric 1270b57cec5SDimitry Andricdef force : F<"force">, 128*85868e8aSDimitry Andric HelpText<"Allow undefined and multiply defined symbols">; 1290b57cec5SDimitry Andricdef force_unresolved : F<"force:unresolved">, 1300b57cec5SDimitry Andric HelpText<"Allow undefined symbols when creating executables">; 1310b57cec5SDimitry Andricdef force_multiple : F<"force:multiple">, 1320b57cec5SDimitry Andric HelpText<"Allow multiply defined symbols when creating executables">; 1330b57cec5SDimitry Andricdef force_multipleres : F<"force:multipleres">, 1340b57cec5SDimitry Andric HelpText<"Allow multiply defined resources when creating executables">; 1350b57cec5SDimitry Andricdefm WX : B<"WX", "Treat warnings as errors", "Don't treat warnings as errors">; 1360b57cec5SDimitry Andric 1370b57cec5SDimitry Andricdefm allowbind : B<"allowbind", "Enable DLL binding (default)", 1380b57cec5SDimitry Andric "Disable DLL binding">; 1390b57cec5SDimitry Andricdefm allowisolation : B<"allowisolation", "Enable DLL isolation (default)", 1400b57cec5SDimitry Andric "Disable DLL isolation">; 1410b57cec5SDimitry Andricdefm appcontainer : B<"appcontainer", 1420b57cec5SDimitry Andric "Image can only be run in an app container", 1430b57cec5SDimitry Andric "Image can run outside an app container (default)">; 1440b57cec5SDimitry Andricdefm dynamicbase : B<"dynamicbase", "Enable ASLR (default unless /fixed)", 1450b57cec5SDimitry Andric "Disable ASLR (default when /fixed)">; 1460b57cec5SDimitry Andricdefm fixed : B<"fixed", "Disable base relocations", 1470b57cec5SDimitry Andric "Enable base relocations (default)">; 1480b57cec5SDimitry Andricdefm highentropyva : B<"highentropyva", 1490b57cec5SDimitry Andric "Enable 64-bit ASLR (default on 64-bit)", 1500b57cec5SDimitry Andric "Disable 64-bit ASLR">; 1510b57cec5SDimitry Andricdefm incremental : B<"incremental", 1520b57cec5SDimitry Andric "Keep original import library if contents are unchanged", 1530b57cec5SDimitry Andric "Overwrite import library even if contents are unchanged">; 1540b57cec5SDimitry Andricdefm integritycheck : B<"integritycheck", 1550b57cec5SDimitry Andric "Set FORCE_INTEGRITY bit in PE header", 1560b57cec5SDimitry Andric "No effect (default)">; 1570b57cec5SDimitry Andricdefm largeaddressaware : B<"largeaddressaware", 1580b57cec5SDimitry Andric "Enable large addresses (default on 64-bit)", 1590b57cec5SDimitry Andric "Disable large addresses (default on 32-bit)">; 1600b57cec5SDimitry Andricdefm nxcompat : B<"nxcompat", "Enable data execution prevention (default)", 1610b57cec5SDimitry Andric "Disable data execution provention">; 1620b57cec5SDimitry Andricdefm safeseh : B<"safeseh", 1630b57cec5SDimitry Andric "Produce an image with Safe Exception Handler (only for x86)", 1640b57cec5SDimitry Andric "Don't produce an image with Safe Exception Handler">; 1650b57cec5SDimitry Andricdefm tsaware : B<"tsaware", 1660b57cec5SDimitry Andric "Create Terminal Server aware executable (default)", 1670b57cec5SDimitry Andric "Create non-Terminal Server aware executable">; 1680b57cec5SDimitry Andric 1690b57cec5SDimitry Andricdef help : F<"help">; 1700b57cec5SDimitry Andric 1710b57cec5SDimitry Andric// /?? and -?? must be before /? and -? to not confuse lib/Options. 1720b57cec5SDimitry Andricdef help_q : Flag<["/??", "-??", "/?", "-?"], "">, Alias<help>; 1730b57cec5SDimitry Andric 1740b57cec5SDimitry Andric// LLD extensions 175*85868e8aSDimitry Andricdef end_lib : F<"end-lib">, 176*85868e8aSDimitry Andric HelpText<"Ends group of objects treated as if they were in a library">; 1770b57cec5SDimitry Andricdef exclude_all_symbols : F<"exclude-all-symbols">; 1780b57cec5SDimitry Andricdef export_all_symbols : F<"export-all-symbols">; 1790b57cec5SDimitry Andricdefm demangle : B<"demangle", 1800b57cec5SDimitry Andric "Demangle symbols in output (default)", 1810b57cec5SDimitry Andric "Do not demangle symbols in output">; 1820b57cec5SDimitry Andricdef include_optional : Joined<["/", "-", "/?", "-?"], "includeoptional:">, 1830b57cec5SDimitry Andric HelpText<"Add symbol as undefined, but allow it to remain undefined">; 1840b57cec5SDimitry Andricdef kill_at : F<"kill-at">; 1850b57cec5SDimitry Andricdef lldmingw : F<"lldmingw">; 1860b57cec5SDimitry Andricdef output_def : Joined<["/", "-", "/?", "-?"], "output-def:">; 1870b57cec5SDimitry Andricdef pdb_source_path : P<"pdbsourcepath", 1880b57cec5SDimitry Andric "Base path used to make relative source file path absolute in PDB">; 1890b57cec5SDimitry Andricdef rsp_quoting : Joined<["--"], "rsp-quoting=">, 1900b57cec5SDimitry Andric HelpText<"Quoting style for response files, 'windows' (default) or 'posix'">; 191*85868e8aSDimitry Andricdef start_lib : F<"start-lib">, 192*85868e8aSDimitry Andric HelpText<"Starts group of objects treated as if they were in a library">; 1930b57cec5SDimitry Andricdef thinlto_emit_imports_files : 1940b57cec5SDimitry Andric F<"thinlto-emit-imports-files">, 1950b57cec5SDimitry Andric HelpText<"Emit .imports files with -thinlto-index-only">; 1960b57cec5SDimitry Andricdef thinlto_index_only : 1970b57cec5SDimitry Andric F<"thinlto-index-only">, 1980b57cec5SDimitry Andric HelpText<"Instead of linking, emit ThinLTO index files">; 1990b57cec5SDimitry Andricdef thinlto_index_only_arg : P< 2000b57cec5SDimitry Andric "thinlto-index-only", 2010b57cec5SDimitry Andric "-thinlto-index-only and also write native module names to file">; 2020b57cec5SDimitry Andricdef thinlto_object_suffix_replace : P< 2030b57cec5SDimitry Andric "thinlto-object-suffix-replace", 2040b57cec5SDimitry Andric "'old;new' replace old suffix with new suffix in ThinLTO index">; 2050b57cec5SDimitry Andricdef thinlto_prefix_replace: P< 2060b57cec5SDimitry Andric "thinlto-prefix-replace", 2070b57cec5SDimitry Andric "'old;new' replace old prefix with new prefix in ThinLTO outputs">; 208*85868e8aSDimitry Andricdef lto_obj_path : P< 209*85868e8aSDimitry Andric "lto-obj-path", 210*85868e8aSDimitry Andric "output native object for merged LTO unit to this path">; 2110b57cec5SDimitry Andricdef dash_dash_version : Flag<["--"], "version">, 2120b57cec5SDimitry Andric HelpText<"Print version information">; 2130b57cec5SDimitry Andricdefm threads: B<"threads", 2140b57cec5SDimitry Andric "Run the linker multi-threaded (default)", 2150b57cec5SDimitry Andric "Do not run the linker multi-threaded">; 2160b57cec5SDimitry Andric 2170b57cec5SDimitry Andric// Flags for debugging 2180b57cec5SDimitry Andricdef lldmap : F<"lldmap">; 2190b57cec5SDimitry Andricdef lldmap_file : Joined<["/", "-", "/?", "-?"], "lldmap:">; 2200b57cec5SDimitry Andricdef show_timing : F<"time">; 2210b57cec5SDimitry Andricdef summary : F<"summary">; 2220b57cec5SDimitry Andric 2230b57cec5SDimitry Andric//============================================================================== 2240b57cec5SDimitry Andric// The flags below do nothing. They are defined only for link.exe compatibility. 2250b57cec5SDimitry Andric//============================================================================== 2260b57cec5SDimitry Andric 2270b57cec5SDimitry Andricclass QF<string name> : Joined<["/", "-", "/?", "-?"], name#":">; 2280b57cec5SDimitry Andric 2290b57cec5SDimitry Andricdef ignoreidl : F<"ignoreidl">; 2300b57cec5SDimitry Andricdef nologo : F<"nologo">; 2310b57cec5SDimitry Andricdef throwingnew : F<"throwingnew">; 2320b57cec5SDimitry Andricdef editandcontinue : F<"editandcontinue">; 2330b57cec5SDimitry Andricdef fastfail : F<"fastfail">; 2340b57cec5SDimitry Andric 2350b57cec5SDimitry Andricdef delay : QF<"delay">; 2360b57cec5SDimitry Andricdef errorreport : QF<"errorreport">; 2370b57cec5SDimitry Andricdef idlout : QF<"idlout">; 2380b57cec5SDimitry Andricdef maxilksize : QF<"maxilksize">; 2390b57cec5SDimitry Andricdef tlbid : QF<"tlbid">; 2400b57cec5SDimitry Andricdef tlbout : QF<"tlbout">; 2410b57cec5SDimitry Andricdef verbose_all : QF<"verbose">; 2420b57cec5SDimitry Andricdef guardsym : QF<"guardsym">; 243