2015-05-29 03:09:30 +08:00
|
|
|
include "llvm/Option/OptParser.td"
|
|
|
|
|
|
|
|
// link.exe accepts options starting with either a dash or a slash.
|
|
|
|
|
|
|
|
// Flag that takes no arguments.
|
|
|
|
class F<string name> : Flag<["/", "-", "-?"], name>;
|
|
|
|
|
|
|
|
// Flag that takes one argument after ":".
|
|
|
|
class P<string name, string help> :
|
|
|
|
Joined<["/", "-", "-?"], name#":">, HelpText<help>;
|
|
|
|
|
2017-10-25 05:17:16 +08:00
|
|
|
// Boolean flag which can be suffixed by ":no". Using it unsuffixed turns the
|
|
|
|
// flag on and using it suffixed by ":no" turns it off.
|
|
|
|
multiclass B<string name, string help_on, string help_off> {
|
|
|
|
def "" : F<name>, HelpText<help_on>;
|
|
|
|
def _no : F<name#":no">, HelpText<help_off>;
|
2015-05-29 03:09:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
def align : P<"align", "Section alignment">;
|
2017-08-15 03:07:27 +08:00
|
|
|
def aligncomm : P<"aligncomm", "Set common symbol alignment">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def alternatename : P<"alternatename", "Define weak alias">;
|
|
|
|
def base : P<"base", "Base address of the program">;
|
2018-05-11 02:19:02 +08:00
|
|
|
def color_diagnostics: Flag<["--"], "color-diagnostics">,
|
|
|
|
HelpText<"Use colors in diagnostics">;
|
|
|
|
def color_diagnostics_eq: Joined<["--"], "color-diagnostics=">,
|
|
|
|
HelpText<"Use colors in diagnostics; one of 'always', 'never', 'auto'">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def defaultlib : P<"defaultlib", "Add the library to the list of input files">;
|
|
|
|
def delayload : P<"delayload", "Delay loaded DLL name">;
|
|
|
|
def entry : P<"entry", "Name of entry point symbol">;
|
2017-04-05 08:43:54 +08:00
|
|
|
def errorlimit : P<"errorlimit",
|
|
|
|
"Maximum number of errors to emit before stopping (0 = no limit)">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def export : P<"export", "Export a function">;
|
|
|
|
// No help text because /failifmismatch is not intended to be used by the user.
|
|
|
|
def failifmismatch : P<"failifmismatch", "">;
|
2018-02-06 09:58:26 +08:00
|
|
|
def guard : P<"guard", "Control flow guard">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def heap : P<"heap", "Size of the heap">;
|
2017-12-28 15:02:13 +08:00
|
|
|
def ignore : P<"ignore", "Specify warning codes to ignore">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def implib : P<"implib", "Import library name">;
|
2018-07-14 12:07:51 +08:00
|
|
|
def lib : F<"lib">,
|
|
|
|
HelpText<"Act like lib.exe; must be first argument if present">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def libpath : P<"libpath", "Additional library search path">;
|
2016-07-26 10:00:42 +08:00
|
|
|
def linkrepro : P<"linkrepro", "Dump linker invocation and input files for debugging">;
|
2017-09-08 08:50:50 +08:00
|
|
|
def lldltocache : P<"lldltocache", "Path to ThinLTO cached object file directory">;
|
|
|
|
def lldltocachepolicy : P<"lldltocachepolicy", "Pruning policy for the ThinLTO cache">;
|
2017-02-09 02:36:41 +08:00
|
|
|
def lldsavetemps : F<"lldsavetemps">,
|
|
|
|
HelpText<"Save temporary files instead of deleting them">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def machine : P<"machine", "Specify target platform">;
|
|
|
|
def merge : P<"merge", "Combine sections">;
|
|
|
|
def mllvm : P<"mllvm", "Options to pass to LLVM">;
|
|
|
|
def nodefaultlib : P<"nodefaultlib", "Remove a default library">;
|
|
|
|
def opt : P<"opt", "Control optimizations">;
|
2018-01-27 08:34:46 +08:00
|
|
|
def order : P<"order", "Put functions in order">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def out : P<"out", "Path to file to write output">;
|
2018-03-24 03:57:25 +08:00
|
|
|
def natvis : P<"natvis", "Path to natvis file to embed in the PDB">;
|
2018-05-11 02:19:02 +08:00
|
|
|
def no_color_diagnostics: F<"no-color-diagnostics">,
|
|
|
|
HelpText<"Do not use colors in diagnostics">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def pdb : P<"pdb", "PDB file path">;
|
2018-04-21 06:11:28 +08:00
|
|
|
def pdbaltpath : P<"pdbaltpath", "PDB file path to embed in the image">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def section : P<"section", "Specify section attributes">;
|
|
|
|
def stack : P<"stack", "Size of the stack">;
|
|
|
|
def stub : P<"stub", "Specify DOS stub file">;
|
|
|
|
def subsystem : P<"subsystem", "Specify subsystem">;
|
2018-05-17 23:11:01 +08:00
|
|
|
def timestamp : P<"timestamp", "Specify the PE header timestamp">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def version : P<"version", "Specify a version number in the PE header">;
|
2017-09-13 15:28:03 +08:00
|
|
|
def wholearchive_file : P<"wholearchive", "Include all object files from this archive">;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
|
|
|
def disallowlib : Joined<["/", "-", "-?"], "disallowlib:">, Alias<nodefaultlib>;
|
|
|
|
|
|
|
|
def manifest : F<"manifest">;
|
|
|
|
def manifest_colon : P<"manifest", "Create manifest file">;
|
|
|
|
def manifestuac : P<"manifestuac", "User access control">;
|
|
|
|
def manifestfile : P<"manifestfile", "Manifest file path">;
|
|
|
|
def manifestdependency : P<"manifestdependency",
|
|
|
|
"Attributes for <dependency> in manifest file">;
|
2016-04-19 09:21:58 +08:00
|
|
|
def manifestinput : P<"manifestinput", "Specify manifest file">;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
|
|
|
// We cannot use multiclass P because class name "incl" is different
|
|
|
|
// from its command line option name. We do this because "include" is
|
|
|
|
// a reserved keyword in tablegen.
|
|
|
|
def incl : Joined<["/", "-"], "include:">,
|
|
|
|
HelpText<"Force symbol to be added to symbol table as undefined one">;
|
|
|
|
|
|
|
|
// "def" is also a keyword.
|
|
|
|
def deffile : Joined<["/", "-"], "def:">,
|
|
|
|
HelpText<"Use module-definition file">;
|
|
|
|
|
2015-08-01 00:40:38 +08:00
|
|
|
def debug : F<"debug">, HelpText<"Embed a symbol table in the image">;
|
2018-04-24 04:54:08 +08:00
|
|
|
def debug_full : F<"debug:full">, Alias<debug>;
|
2016-08-09 06:02:44 +08:00
|
|
|
def debugtype : P<"debugtype", "Debug Info Options">;
|
2015-08-01 00:40:38 +08:00
|
|
|
def dll : F<"dll">, HelpText<"Create a DLL">;
|
2016-08-09 06:02:44 +08:00
|
|
|
def driver : P<"driver", "Generate a Windows NT Kernel Mode Driver">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def nodefaultlib_all : F<"nodefaultlib">;
|
|
|
|
def noentry : F<"noentry">;
|
|
|
|
def profile : F<"profile">;
|
2018-05-17 23:11:01 +08:00
|
|
|
def repro : F<"Brepro">, HelpText<"Use a hash of the executable as the PE header timestamp">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def swaprun_cd : F<"swaprun:cd">;
|
|
|
|
def swaprun_net : F<"swaprun:net">;
|
|
|
|
def verbose : F<"verbose">;
|
2017-09-13 15:28:03 +08:00
|
|
|
def wholearchive_flag : F<"wholearchive">;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
|
|
|
def force : F<"force">,
|
|
|
|
HelpText<"Allow undefined symbols when creating executables">;
|
|
|
|
def force_unresolved : F<"force:unresolved">;
|
2017-10-25 05:19:22 +08:00
|
|
|
defm WX : B<"WX", "Treat warnings as errors", "Don't treat warnings as errors">;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
2017-10-25 05:17:16 +08:00
|
|
|
defm allowbind : B<"allowbind", "Enable DLL binding (default)",
|
|
|
|
"Disable DLL binding">;
|
|
|
|
defm allowisolation : B<"allowisolation", "Enable DLL isolation (default)",
|
|
|
|
"Disable DLL isolation">;
|
2017-04-07 07:07:53 +08:00
|
|
|
defm appcontainer : B<"appcontainer",
|
2017-10-25 05:17:16 +08:00
|
|
|
"Image can only be run in an app container",
|
|
|
|
"Image can run outside an app container (default)">;
|
|
|
|
defm dynamicbase : B<"dynamicbase", "Enable ASLR (default unless /fixed)",
|
|
|
|
"Disable ASLR (default when /fixed)">;
|
|
|
|
defm fixed : B<"fixed", "Disable base relocations",
|
|
|
|
"Enable base relocations (default)">;
|
|
|
|
defm highentropyva : B<"highentropyva",
|
|
|
|
"Enable 64-bit ASLR (default on 64-bit)",
|
|
|
|
"Disable 64-bit ASLR">;
|
2018-02-01 07:44:00 +08:00
|
|
|
defm incremental : B<"incremental",
|
|
|
|
"Keep original import library if contents are unchanged",
|
2018-05-31 21:43:02 +08:00
|
|
|
"Overwrite import library even if contents are unchanged">;
|
|
|
|
defm integritycheck : B<"integritycheck",
|
|
|
|
"Set FORCE_INTEGRITY bit in PE header",
|
|
|
|
"No effect (default)">;
|
2017-10-25 05:17:16 +08:00
|
|
|
defm largeaddressaware : B<"largeaddressaware",
|
|
|
|
"Enable large addresses (default on 64-bit)",
|
|
|
|
"Disable large addresses (default on 32-bit)">;
|
|
|
|
defm nxcompat : B<"nxcompat", "Enable data execution prevention (default)",
|
|
|
|
"Disable data execution provention">;
|
|
|
|
defm safeseh : B<"safeseh",
|
|
|
|
"Produce an image with Safe Exception Handler (only for x86)",
|
|
|
|
"Don't produce an image with Safe Exception Handler">;
|
|
|
|
defm tsaware : B<"tsaware",
|
|
|
|
"Create Terminal Server aware executable (default)",
|
|
|
|
"Create non-Terminal Server aware executable">;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
|
|
|
def help : F<"help">;
|
|
|
|
def help_q : Flag<["/?", "-?"], "">, Alias<help>;
|
|
|
|
|
2015-09-22 07:43:31 +08:00
|
|
|
// LLD extensions
|
2017-12-15 02:07:04 +08:00
|
|
|
def debug_ghash : F<"debug:ghash">;
|
2017-11-04 06:10:37 +08:00
|
|
|
def debug_dwarf : F<"debug:dwarf">;
|
2018-06-29 14:08:25 +08:00
|
|
|
def debug_symtab : F<"debug:symtab">;
|
2017-10-12 13:37:13 +08:00
|
|
|
def export_all_symbols : F<"export-all-symbols">;
|
2018-03-15 04:17:16 +08:00
|
|
|
def kill_at : F<"kill-at">;
|
2017-09-14 03:29:39 +08:00
|
|
|
def lldmingw : F<"lldmingw">;
|
2017-10-12 13:37:13 +08:00
|
|
|
def output_def : Joined<["/", "-"], "output-def:">;
|
2018-07-19 12:56:22 +08:00
|
|
|
def pdb_source_path : P<"pdbsourcepath",
|
|
|
|
"Base path used to make relative source file path absolute in PDB">;
|
2017-09-06 07:46:45 +08:00
|
|
|
def rsp_quoting : Joined<["--"], "rsp-quoting=">,
|
|
|
|
HelpText<"Quoting style for response files, 'windows' (default) or 'posix'">;
|
2017-10-23 22:57:53 +08:00
|
|
|
def dash_dash_version : Flag<["--"], "version">,
|
|
|
|
HelpText<"Print version information">;
|
2015-09-22 07:43:31 +08:00
|
|
|
|
2015-06-27 02:58:24 +08:00
|
|
|
// Flags for debugging
|
2016-12-10 04:54:44 +08:00
|
|
|
def lldmap : F<"lldmap">;
|
|
|
|
def lldmap_file : Joined<["/", "-"], "lldmap:">;
|
2018-01-18 03:16:26 +08:00
|
|
|
def show_timing : F<"time">;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
// The flags below do nothing. They are defined only for link.exe compatibility.
|
|
|
|
//==============================================================================
|
|
|
|
|
|
|
|
class QF<string name> : Joined<["/", "-", "-?"], name#":">;
|
|
|
|
|
|
|
|
multiclass QB<string name> {
|
|
|
|
def "" : F<name>;
|
|
|
|
def _no : F<name#":no">;
|
|
|
|
}
|
|
|
|
|
|
|
|
def functionpadmin : F<"functionpadmin">;
|
|
|
|
def ignoreidl : F<"ignoreidl">;
|
|
|
|
def nologo : F<"nologo">;
|
2015-07-30 05:01:15 +08:00
|
|
|
def throwingnew : F<"throwingnew">;
|
2015-08-12 00:46:08 +08:00
|
|
|
def editandcontinue : F<"editandcontinue">;
|
2016-03-26 02:09:29 +08:00
|
|
|
def fastfail : F<"fastfail">;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
|
|
|
def delay : QF<"delay">;
|
|
|
|
def errorreport : QF<"errorreport">;
|
|
|
|
def idlout : QF<"idlout">;
|
|
|
|
def maxilksize : QF<"maxilksize">;
|
|
|
|
def tlbid : QF<"tlbid">;
|
|
|
|
def tlbout : QF<"tlbout">;
|
|
|
|
def verbose_all : QF<"verbose">;
|
2015-09-04 00:20:47 +08:00
|
|
|
def guardsym : QF<"guardsym">;
|