[Driver] Error out instead of silently ignoring on invalid -z argument.

This matches what both ld.bfd and gold do.

llvm-svn: 250775
This commit is contained in:
Davide Italiano 2015-10-20 00:34:04 +00:00
parent 7d3a2f067f
commit 1ea1fd6b34
2 changed files with 5 additions and 0 deletions

View File

@ -164,6 +164,8 @@ void LinkerDriver::createFiles(opt::InputArgList &Args) {
Config->ZNodelete = true;
else if (Arg->getValue() == StringRef("now"))
Config->ZNow = true;
else
error(Twine(Arg->getValue()) + ": unknown -z option");
}
for (auto *Arg : Args) {

View File

@ -220,3 +220,6 @@ _start:
# RUN: not ld.lld2 %t -o %t -m wrong_emul 2>&1 | FileCheck --check-prefix=UNKNOWN_EMUL %s
# UNKNOWN_EMUL: Unknown emulation: wrong_emul
# RUN: not ld.lld2 %t -o %t -z notanoption 2>&1 | FileCheck --check-prefix=UNKNOWN_ZOPT %s
# UNKNOWN_ZOPT: notanoption: unknown -z option