[PATCH] D114748: [ELF] Change -z unknown from error to warning
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 29 15:20:13 PST 2021
MaskRay created this revision.
MaskRay added reviewers: jrtc27, peter.smith.
Herald added subscribers: arichardson, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
There is a trend of having more optional options (usually security
hardening related) like -z cet-report=, -z bti-report=, -z force-bti.
If ld.lld 14.0.0 uses a warning, in 15/16/17/... timeframe when people
add new options to software, they can worry less about linker errors on ld.lld 14.0.0.
In some cases `-z foo` does essential work where a silent ignore can be
problematic, but the user has received a warning. From my observation, the
doing-essential-work `-z foo` is much fewer than the converse. In addition,
the user who cares can use `--fatal-warnings`. It is unclear whether we need
something like `clang -Wunknown-warning-option`
If we ever run into unfortunate transition like `-z start-stop-gc`, the
affected software can blindly add the `-z` option, without worrying it
may cause a linker error to LLD 14.0.0.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D114748
Files:
lld/ELF/Driver.cpp
lld/test/ELF/driver.test
Index: lld/test/ELF/driver.test
===================================================================
--- lld/test/ELF/driver.test
+++ lld/test/ELF/driver.test
@@ -58,12 +58,12 @@
# RUN: not ld.lld %t -output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR9 %s
# 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
+# RUN: ld.lld %t -z foo 2>&1 | FileCheck -check-prefix=ERR10 %s
+# RUN: ld.lld %t -z foo --version 2>&1 | FileCheck -check-prefix=ERR10 %s
+# ERR10: warning: unknown -z value: foo
## Check we report "unknown -z value" error even with -v.
-# RUN: not ld.lld %t -z foo -v 2>&1 | FileCheck -check-prefix=ERR10 %s
+# RUN: ld.lld %t -z foo -v 2>&1 | FileCheck -check-prefix=ERR10 %s
# RUN: not ld.lld %t -z max-page-size 2>&1 | FileCheck -check-prefix=ERR11 %s
# ERR11: unknown -z value: max-page-size
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -464,7 +464,7 @@
static void checkZOptions(opt::InputArgList &args) {
for (auto *arg : args.filtered(OPT_z))
if (!isKnownZFlag(arg->getValue()))
- error("unknown -z value: " + StringRef(arg->getValue()));
+ warn("unknown -z value: " + StringRef(arg->getValue()));
}
void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114748.390492.patch
Type: text/x-patch
Size: 1497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211129/36f76d23/attachment.bin>
More information about the llvm-commits
mailing list