summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2019-02-13 18:48:39 +0000
committerRui Ueyama <ruiu@google.com>2019-02-13 18:48:39 +0000
commit265e8e8252a6f4bd98bf807718d3fed6748f1e3f (patch)
treeba5d65e7a11ad357e029c58c808967c08aaae330
parent9239b9a0e25dd30ffe546d914a76a988ace89c19 (diff)
downloadbcm5719-llvm-265e8e8252a6f4bd98bf807718d3fed6748f1e3f.tar.gz
bcm5719-llvm-265e8e8252a6f4bd98bf807718d3fed6748f1e3f.zip
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 llvm-svn: 353967
-rw-r--r--lld/ELF/Driver.cpp2
-rw-r--r--lld/test/ELF/driver.test1
2 files changed, 2 insertions, 1 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index b6794fc529c..b44915a3eb6 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/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/lld/test/ELF/driver.test b/lld/test/ELF/driver.test
index 585800a3b0b..cc3e7898f09 100644
--- a/lld/test/ELF/driver.test
+++ b/lld/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.
OpenPOWER on IntegriCloud