Config = &C;
Driver = &D;
Script = &LS;
- Driver->main(Args.slice(1));
+ Driver->main(Args);
return !HasError;
}
void LinkerDriver::main(ArrayRef<const char *> ArgsArr) {
initSymbols();
- opt::InputArgList Args = parseArgs(&Alloc, ArgsArr);
+ opt::InputArgList Args = parseArgs(&Alloc, ArgsArr.slice(1));
+ if (Args.hasArg(OPT_help)) {
+ printHelp(ArgsArr[0]);
+ return;
+ }
if (Args.hasArg(OPT_version)) {
printVersion();
return;
#undef OPTION
};
+void printHelp(const char *Argv0);
void printVersion();
std::string findFromSearchPaths(StringRef Path);
return Args;
}
+void elf::printHelp(const char *Argv0) {
+ ELFOptTable Table;
+ Table.PrintHelp(outs(), Argv0, "lld", false);
+}
+
void elf::printVersion() {
outs() << "LLD " << getLLDVersion();
std::string S = getLLDRepositoryVersion();
def hash_style : Separate<["--", "-"], "hash-style">,
HelpText<"Specify hash style (sysv, gnu or both)">;
+def help : Flag<["--", "-"], "help">,
+ HelpText<"Print option help">;
+
def icf : Flag<["--"], "icf=all">,
HelpText<"Enable Identical Code Folding.">;
# RUN: not ld.lld %t -o /no/such/file 2>&1 | FileCheck -check-prefix=MISSING %s
# MISSING: failed to open /no/such/file
+# RUN: ld.lld --help 2>&1 | FileCheck -check-prefix=HELP %s
+# HELP: USAGE:
+
# RUN: ld.lld --version 2>&1 | FileCheck -check-prefix=VERSION %s
# VERSION: LLD