"lto-obj-path",
"output native object for merged LTO unit to this path">;
def dash_dash_version : Flag<["--"], "version">,
- HelpText<"Print version information">;
+ HelpText<"Display the version number and exit">;
def threads
: P<"threads", "Number of threads. '1' disables multi-threading. By "
"default all available hardware threads are used">;
if (args.hasArg(OPT_help_hidden)) {
parser.printHelp(argsArr[0], /*showHidden=*/true);
return true;
- } else if (args.hasArg(OPT_help)) {
+ }
+ if (args.hasArg(OPT_help)) {
parser.printHelp(argsArr[0], /*showHidden=*/false);
return true;
}
+ if (args.hasArg(OPT_version)) {
+ message(getLLDVersion());
+ return true;
+ }
if (const char *path = getReproduceOption(args)) {
// Note that --reproduce is a debug option so you can ignore it
def reproduce_eq: Joined<["--"], "reproduce=">,
Alias<!cast<Separate>(reproduce)>,
HelpText<"Write tar file containing inputs and command to reproduce link">;
+def version: Flag<["--"], "version">,
+ HelpText<"Display the version number and exit">;
// This is a complete Options.td compiled from Apple's ld(1) manpage
def grp_rare : OptionGroup<"rare">, HelpText<"RARELY USED">;
def v : Flag<["-"], "v">,
- HelpText<"Print the linker version">,
+ HelpText<"Print the linker version and search paths and exit">,
Group<grp_rare>;
def version_details : Flag<["-"], "version_details">,
HelpText<"Print the linker version in JSON form">,
-# RUN: not %lld ---help 2>&1 | FileCheck -check-prefix=SPELLHELP %s
+# RUN: %lld --version | FileCheck -check-prefix=VERSION %s
+VERSION: {{LLD [0-9]+\.[0-9]+}}
+# RUN: not %lld ---help 2>&1 | FileCheck -check-prefix=SPELLHELP %s
SPELLHELP: error: unknown argument '---help', did you mean '--help'
# FIXME: This should say "no input files" instead
SPELLHELP: error: undefined symbol: _main