mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 07:01:03 +08:00
[Gnu] Ignore unknown arguments, and print message.
llvm-svn: 195597
This commit is contained in:
@@ -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());
|
||||
|
||||
5
lld/test/elf/ignore-unknownoption.test
Normal file
5
lld/test/elf/ignore-unknownoption.test
Normal 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
|
||||
Reference in New Issue
Block a user