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.
|
2019-05-07 22:15:35 +08:00
|
|
|
class F<string name> : Flag<["/", "-", "/?", "-?"], name>;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
|
|
|
// Flag that takes one argument after ":".
|
|
|
|
class P<string name, string help> :
|
2019-05-07 22:15:35 +08:00
|
|
|
Joined<["/", "-", "/?", "-?"], name#":">, HelpText<help>;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2020-04-26 05:49:44 +08:00
|
|
|
// Same as B<> above, but without help texts, for private undocumented
|
|
|
|
// options.
|
|
|
|
multiclass B_priv<string name> {
|
|
|
|
def "" : F<name>;
|
|
|
|
def _no : F<name#":no">;
|
|
|
|
}
|
|
|
|
|
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">,
|
2019-09-15 07:41:42 +08:00
|
|
|
HelpText<"Use colors in diagnostics">;
|
2018-05-11 02:19:02 +08:00
|
|
|
def color_diagnostics_eq: Joined<["--"], "color-diagnostics=">,
|
2019-09-15 07:41:42 +08:00
|
|
|
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", "">;
|
2019-05-24 20:42:36 +08:00
|
|
|
def filealign : P<"filealign", "Section alignment in the output file">;
|
2019-02-23 09:46:18 +08:00
|
|
|
def functionpadmin : F<"functionpadmin">;
|
2019-09-15 07:41:42 +08:00
|
|
|
def functionpadmin_opt : P<"functionpadmin",
|
|
|
|
"Prepares an image for hotpatching">;
|
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">;
|
2019-09-15 07:41:42 +08:00
|
|
|
def linkrepro : P<"linkrepro",
|
|
|
|
"Dump linker invocation and input files for debugging">;
|
2019-09-13 21:13:52 +08:00
|
|
|
def lldignoreenv : F<"lldignoreenv">,
|
|
|
|
HelpText<"Ignore environment variables like %LIB%">;
|
2019-09-15 07:41:42 +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">,
|
2019-09-15 07:41:42 +08:00
|
|
|
HelpText<"Do not use colors in diagnostics">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def pdb : P<"pdb", "PDB file path">;
|
2020-01-16 07:09:25 +08:00
|
|
|
def pdbstripped : P<"pdbstripped", "Stripped PDB file path">;
|
2018-04-21 06:11:28 +08:00
|
|
|
def pdbaltpath : P<"pdbaltpath", "PDB file path to embed in the image">;
|
2020-04-08 04:16:22 +08:00
|
|
|
def pdbstream : Joined<["/", "-", "/?", "-?"], "pdbstream:">,
|
|
|
|
MetaVarName<"<name>=<file>">,
|
|
|
|
HelpText<"Embed the contents of <file> in the PDB as named stream <name>">;
|
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">;
|
2019-09-15 07:41:42 +08:00
|
|
|
def wholearchive_file : P<"wholearchive",
|
|
|
|
"Include all object files from this library">;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
2019-05-07 22:15:35 +08:00
|
|
|
def disallowlib : Joined<["/", "-", "/?", "-?"], "disallowlib:">,
|
|
|
|
Alias<nodefaultlib>;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
2019-01-10 03:18:03 +08:00
|
|
|
def manifest : F<"manifest">, HelpText<"Create .manifest file">;
|
|
|
|
def manifest_colon : P<
|
|
|
|
"manifest",
|
|
|
|
"NO disables manifest output; EMBED[,ID=#] embeds manifest as resource in the image">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def manifestuac : P<"manifestuac", "User access control">;
|
2019-01-10 03:18:03 +08:00
|
|
|
def manifestfile : P<"manifestfile", "Manifest output path, with /manifest">;
|
|
|
|
def manifestdependency : P<
|
|
|
|
"manifestdependency",
|
|
|
|
"Attributes for <dependency> element in manifest file; implies /manifest">;
|
|
|
|
def manifestinput : P<
|
|
|
|
"manifestinput",
|
|
|
|
"Additional manifest inputs; only valid with /manifest:embed">;
|
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.
|
2019-05-07 22:15:35 +08:00
|
|
|
def incl : Joined<["/", "-", "/?", "-?"], "include:">,
|
2015-05-29 03:09:30 +08:00
|
|
|
HelpText<"Force symbol to be added to symbol table as undefined one">;
|
|
|
|
|
|
|
|
// "def" is also a keyword.
|
2019-05-07 22:15:35 +08:00
|
|
|
def deffile : Joined<["/", "-", "/?", "-?"], "def:">,
|
2015-05-29 03:09:30 +08:00
|
|
|
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-09-24 23:28:03 +08:00
|
|
|
def debug_opt : P<"debug", "Embed a symbol table in the image with option">;
|
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">;
|
2019-11-13 12:53:15 +08:00
|
|
|
def driver : F<"driver">, HelpText<"Generate a Windows NT Kernel Mode Driver">;
|
|
|
|
def driver_wdm : F<"driver:wdm">,
|
|
|
|
HelpText<"Set IMAGE_FILE_UP_SYSTEM_ONLY bit in PE header">;
|
|
|
|
def driver_uponly : F<"driver:uponly">,
|
|
|
|
HelpText<"Set IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER bit in PE header">;
|
|
|
|
def driver_wdm_uponly : F<"driver:wdm,uponly">;
|
|
|
|
def driver_uponly_wdm : F<"driver:uponly,wdm">;
|
2019-01-10 03:18:03 +08:00
|
|
|
def nodefaultlib_all : F<"nodefaultlib">,
|
|
|
|
HelpText<"Remove all default libraries">;
|
|
|
|
def noentry : F<"noentry">,
|
|
|
|
HelpText<"Don't add reference to DllMainCRTStartup; only valid with /dll">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def profile : F<"profile">;
|
2019-01-10 03:18:03 +08:00
|
|
|
def repro : F<"Brepro">,
|
|
|
|
HelpText<"Use a hash of the executable as the PE header timestamp">;
|
2019-10-04 15:27:38 +08:00
|
|
|
def reproduce : P<"reproduce",
|
|
|
|
"Dump linker invocation and input files for debugging">;
|
2019-04-25 22:02:26 +08:00
|
|
|
def swaprun : P<"swaprun",
|
|
|
|
"Comma-separated list of 'cd' or 'net'">;
|
|
|
|
def swaprun_cd : F<"swaprun:cd">, Alias<swaprun>, AliasArgs<["cd"]>,
|
|
|
|
HelpText<"Make loader run output binary from swap instead of from CD">;
|
|
|
|
def swaprun_net : F<"swaprun:net">, Alias<swaprun>, AliasArgs<["net"]>,
|
|
|
|
HelpText<"Make loader run output binary from swap instead of from network">;
|
2015-05-29 03:09:30 +08:00
|
|
|
def verbose : F<"verbose">;
|
2019-09-15 07:41:42 +08:00
|
|
|
def wholearchive_flag : F<"wholearchive">,
|
|
|
|
HelpText<"Include all object files from all libraries">;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
|
|
|
def force : F<"force">,
|
2019-09-15 07:41:42 +08:00
|
|
|
HelpText<"Allow undefined and multiply defined symbols">;
|
2018-09-14 06:05:10 +08:00
|
|
|
def force_unresolved : F<"force:unresolved">,
|
2015-05-29 03:09:30 +08:00
|
|
|
HelpText<"Allow undefined symbols when creating executables">;
|
2018-09-14 06:05:10 +08:00
|
|
|
def force_multiple : F<"force:multiple">,
|
|
|
|
HelpText<"Allow multiply defined symbols when creating executables">;
|
2019-05-03 05:21:55 +08:00
|
|
|
def force_multipleres : F<"force:multipleres">,
|
|
|
|
HelpText<"Allow multiply defined resources when creating executables">;
|
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)">;
|
2020-03-13 18:41:18 +08:00
|
|
|
defm cetcompat : B<"cetcompat", "Mark executable image as compatible with Control-flow Enforcement Technology (CET) Shadow Stack",
|
|
|
|
"Don't mark executable image as compatible with Control-flow Enforcement Technology (CET) Shadow Stack (default)">;
|
2017-10-25 05:17:16 +08:00
|
|
|
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">;
|
2019-05-07 22:15:35 +08:00
|
|
|
|
|
|
|
// /?? and -?? must be before /? and -? to not confuse lib/Options.
|
|
|
|
def help_q : Flag<["/??", "-??", "/?", "-?"], "">, Alias<help>;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
2015-09-22 07:43:31 +08:00
|
|
|
// LLD extensions
|
2020-04-26 05:49:44 +08:00
|
|
|
defm auto_import : B_priv<"auto-import">;
|
|
|
|
defm runtime_pseudo_reloc : B_priv<"runtime-pseudo-reloc">;
|
2019-09-04 04:32:16 +08:00
|
|
|
def end_lib : F<"end-lib">,
|
2019-09-15 07:41:42 +08:00
|
|
|
HelpText<"Ends group of objects treated as if they were in a library">;
|
2019-02-20 05:57:44 +08:00
|
|
|
def exclude_all_symbols : F<"exclude-all-symbols">;
|
2017-10-12 13:37:13 +08:00
|
|
|
def export_all_symbols : F<"export-all-symbols">;
|
2019-03-12 07:02:18 +08:00
|
|
|
defm demangle : B<"demangle",
|
|
|
|
"Demangle symbols in output (default)",
|
|
|
|
"Do not demangle symbols in output">;
|
2019-06-09 02:26:18 +08:00
|
|
|
def include_optional : Joined<["/", "-", "/?", "-?"], "includeoptional:">,
|
|
|
|
HelpText<"Add symbol as undefined, but allow it to remain undefined">;
|
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">;
|
2020-07-28 04:44:41 +08:00
|
|
|
def noseh : F<"noseh">;
|
2019-05-07 22:15:35 +08:00
|
|
|
def output_def : Joined<["/", "-", "/?", "-?"], "output-def:">;
|
2018-07-19 12:56:22 +08:00
|
|
|
def pdb_source_path : P<"pdbsourcepath",
|
2019-09-15 07:41:42 +08:00
|
|
|
"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'">;
|
2019-09-04 04:32:16 +08:00
|
|
|
def start_lib : F<"start-lib">,
|
2019-09-15 07:41:42 +08:00
|
|
|
HelpText<"Starts group of objects treated as if they were in a library">;
|
[lld-link] implement -thinlto-index-only
Summary:
This implements -thinlto-index-only, -thinlto-index-only:,
and -thinlto-emit-imports-files options in lld-link. They are
analogous to their counterparts in ld.lld: -thinlto-index-only
causes us to perform ThinLTO's thin link and write index files,
but not perform code generation. -thinlto-index-only: does the
same, but also writes a text file listing the native object
files expected to be generated. -thinlto-emit-imports-files
creates a text file next to each index file, listing the files
to import from.
Reviewers: ruiu, tejohnson, pcc, rnk
Subscribers: mehdi_amini, steven_wu, dexonsmith, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64461
llvm-svn: 365800
2019-07-12 02:03:14 +08:00
|
|
|
def thinlto_emit_imports_files :
|
|
|
|
F<"thinlto-emit-imports-files">,
|
|
|
|
HelpText<"Emit .imports files with -thinlto-index-only">;
|
|
|
|
def thinlto_index_only :
|
|
|
|
F<"thinlto-index-only">,
|
|
|
|
HelpText<"Instead of linking, emit ThinLTO index files">;
|
|
|
|
def thinlto_index_only_arg : P<
|
|
|
|
"thinlto-index-only",
|
|
|
|
"-thinlto-index-only and also write native module names to file">;
|
2019-07-12 02:48:58 +08:00
|
|
|
def thinlto_object_suffix_replace : P<
|
|
|
|
"thinlto-object-suffix-replace",
|
|
|
|
"'old;new' replace old suffix with new suffix in ThinLTO index">;
|
|
|
|
def thinlto_prefix_replace: P<
|
|
|
|
"thinlto-prefix-replace",
|
|
|
|
"'old;new' replace old prefix with new prefix in ThinLTO outputs">;
|
2019-08-22 02:24:59 +08:00
|
|
|
def lto_obj_path : P<
|
|
|
|
"lto-obj-path",
|
|
|
|
"output native object for merged LTO unit to this path">;
|
2017-10-23 22:57:53 +08:00
|
|
|
def dash_dash_version : Flag<["--"], "version">,
|
|
|
|
HelpText<"Print version information">;
|
[lld][COFF][ELF][WebAssembly] Replace --[no-]threads /threads[:no] with --threads={1,2,...} /threads:{1,2,...}
--no-threads is a name copied from gold.
gold has --no-thread, --thread-count and several other --thread-count-*.
There are needs to customize the number of threads (running several lld
processes concurrently or customizing the number of LTO threads).
Having a single --threads=N is a straightforward replacement of gold's
--no-threads + --thread-count.
--no-threads is used rarely. So just delete --no-threads instead of
keeping it for compatibility for a while.
If --threads= is specified (ELF,wasm; COFF /threads: is similar),
--thinlto-jobs= defaults to --threads=,
otherwise all available hardware threads are used.
There is currently no way to override a --threads={1,2,...}. It is still
a debate whether we should use --threads=all.
Reviewed By: rnk, aganea
Differential Revision: https://reviews.llvm.org/D76885
2020-03-18 03:40:19 +08:00
|
|
|
def threads
|
|
|
|
: P<"threads", "Number of threads. '1' disables multi-threading. By "
|
|
|
|
"default all available hardware threads are used">;
|
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">;
|
2019-05-07 22:15:35 +08:00
|
|
|
def lldmap_file : Joined<["/", "-", "/?", "-?"], "lldmap:">;
|
2020-03-24 05:06:48 +08:00
|
|
|
def map : F<"map">;
|
|
|
|
def map_file : Joined<["/", "-", "/?", "-?"], "map:">;
|
2018-01-18 03:16:26 +08:00
|
|
|
def show_timing : F<"time">;
|
2019-03-15 02:45:08 +08:00
|
|
|
def summary : F<"summary">;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
// The flags below do nothing. They are defined only for link.exe compatibility.
|
|
|
|
//==============================================================================
|
|
|
|
|
2019-05-07 22:15:35 +08:00
|
|
|
class QF<string name> : Joined<["/", "-", "/?", "-?"], name#":">;
|
2015-05-29 03:09:30 +08:00
|
|
|
|
|
|
|
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">;
|