[Gnu] Ignore unknown arguments, and print message.

llvm-svn: 195597
This commit is contained in:
Shankar Easwaran
2013-11-25 04:22:11 +00:00
parent f6ec3faf18
commit 709447847a
2 changed files with 12 additions and 0 deletions

View File

@@ -160,6 +160,13 @@ bool GnuLdDriver::parse(int argc, const char *argv[],
int index = 0;
// Ignore unknown arguments.
for (auto it = parsedArgs->filtered_begin(OPT_UNKNOWN),
ie = parsedArgs->filtered_end();
it != ie; ++it)
diagnostics << "warning: ignoring unknown argument: " << (*it)->getValue()
<< "\n";
// Set sys root path.
if (llvm::opt::Arg *sysRootPath = parsedArgs->getLastArg(OPT_sysroot))
ctx->setSysroot(sysRootPath->getValue());

View File

@@ -0,0 +1,5 @@
# This test tests that lld is able to print unknown options that are not
# recognized.
RUN: not lld -flavor gnu -target x86_64 --gc-sections 2> %t
RUN: FileCheck %s < %t
CHECK: warning: ignoring unknown argument: --gc-sections