[lld] r353967 - Show "Unknown -z option" error message even if --version or --help are given.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 13 10:48:39 PST 2019
Author: ruiu
Date: Wed Feb 13 10:48:39 2019
New Revision: 353967
URL: http://llvm.org/viewvc/llvm-project?rev=353967&view=rev
Log:
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
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/test/ELF/driver.test
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=353967&r1=353966&r2=353967&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed Feb 13 10:48:39 2019
@@ -370,6 +370,7 @@ void LinkerDriver::main(ArrayRef<const c
// 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 c
}
readConfigs(Args);
- checkZOptions(Args);
// The behavior of -v or --version is a bit strange, but this is
// needed for compatibility with GNU linkers.
Modified: lld/trunk/test/ELF/driver.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/driver.test?rev=353967&r1=353966&r2=353967&view=diff
==============================================================================
--- lld/trunk/test/ELF/driver.test (original)
+++ lld/trunk/test/ELF/driver.test Wed Feb 13 10:48:39 2019
@@ -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.
More information about the llvm-commits
mailing list