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