diff options
author | Rui Ueyama <ruiu@google.com> | 2019-02-13 18:48:39 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2019-02-13 18:48:39 +0000 |
commit | bb3788a37f05f73bb70240c0bd9b619f3ffa2d00 (patch) | |
tree | c26a1d000b2761fe7dce3b1abc615d65a224053f | |
parent | 983304d126315155c2cf88e872930a2e7b4d9cac (diff) | |
download | lld-bb3788a37f05f73bb70240c0bd9b619f3ffa2d00.tar.gz |
Show "Unknown -z option" error message even if --version or --help are given.
Previously, we validated -z options after we process --version or --help flags.
So, if one of these flags is given, we wouldn't show an "unknown -z option"
error. This patch fixes that behavior.
Differential Revision: https://reviews.llvm.org/D55446
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@353967 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | ELF/Driver.cpp | 2 | ||||
-rw-r--r-- | test/ELF/driver.test | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/ELF/Driver.cpp b/ELF/Driver.cpp index b6794fc52..b44915a3e 100644 --- a/ELF/Driver.cpp +++ b/ELF/Driver.cpp @@ -370,6 +370,7 @@ void LinkerDriver::main(ArrayRef<const char *> ArgsArr) { // Interpret this flag early because error() depends on them. errorHandler().ErrorLimit = args::getInteger(Args, OPT_error_limit, 20); + checkZOptions(Args); // Handle -help if (Args.hasArg(OPT_help)) { @@ -410,7 +411,6 @@ void LinkerDriver::main(ArrayRef<const char *> ArgsArr) { } readConfigs(Args); - checkZOptions(Args); // The behavior of -v or --version is a bit strange, but this is // needed for compatibility with GNU linkers. diff --git a/test/ELF/driver.test b/test/ELF/driver.test index 585800a3b..cc3e7898f 100644 --- a/test/ELF/driver.test +++ b/test/ELF/driver.test @@ -60,6 +60,7 @@ # ERR9: cannot open output file utput=/no/such/file # RUN: not ld.lld %t -z foo 2>&1 | FileCheck -check-prefix=ERR10 %s +# RUN: not ld.lld %t -z foo --version 2>&1 | FileCheck -check-prefix=ERR10 %s # ERR10: unknown -z value: foo ## Check we report "unknown -z value" error even with -v. |