parent
1abcf370fd
commit
1eb9f44118
|
@ -41,7 +41,7 @@ bool elf::link(ArrayRef<const char *> Args, raw_ostream &Error) {
|
|||
Config = &C;
|
||||
Driver = &D;
|
||||
Script = &LS;
|
||||
Driver->main(Args.slice(1));
|
||||
Driver->main(Args);
|
||||
return !HasError;
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,11 @@ static bool hasZOption(opt::InputArgList &Args, StringRef Key) {
|
|||
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;
|
||||
|
|
|
@ -53,6 +53,7 @@ enum {
|
|||
#undef OPTION
|
||||
};
|
||||
|
||||
void printHelp(const char *Argv0);
|
||||
void printVersion();
|
||||
|
||||
std::string findFromSearchPaths(StringRef Path);
|
||||
|
|
|
@ -79,6 +79,11 @@ opt::InputArgList elf::parseArgs(llvm::BumpPtrAllocator *A,
|
|||
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();
|
||||
|
|
|
@ -57,6 +57,9 @@ def fini : Separate<["-"], "fini">, MetaVarName<"<symbol>">,
|
|||
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.">;
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
# 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
|
||||
|
||||
|
|
Loading…
Reference in New Issue