[PATCH] D136569: [ELF] Add --no-warnings/-w
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 24 10:54:27 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG26fcee601fb3: [ELF] Add --no-warnings/-w (authored by MaskRay).
Changed prior to commit:
https://reviews.llvm.org/D136569?vs=470021&id=470222#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136569/new/
https://reviews.llvm.org/D136569
Files:
lld/ELF/Driver.cpp
lld/ELF/Options.td
lld/docs/ReleaseNotes.rst
lld/docs/ld.lld.1
lld/test/ELF/fatal-warnings.s
lld/test/ELF/no-inhibit-exec.s
lld/test/ELF/warnings.s
Index: lld/test/ELF/warnings.s
===================================================================
--- lld/test/ELF/warnings.s
+++ lld/test/ELF/warnings.s
@@ -9,6 +9,10 @@
# RUN: not ld.lld --warn-common --fatal-warnings %t1.o %t2.o -o /dev/null 2>&1 | \
# RUN: FileCheck -check-prefix=ERR %s
+## --no-warnings/-w suppresses warnings and cancel --fatal-warnings.
+# RUN: ld.lld --no-warnings --warn-common %t1.o %t2.o -o /dev/null 2>&1 | count 0
+# RUN: ld.lld -w --fatal-warnings --warn-common %t1.o %t2.o -o /dev/null 2>&1 | count 0
+
.globl _start
_start:
Index: lld/test/ELF/no-inhibit-exec.s
===================================================================
--- lld/test/ELF/no-inhibit-exec.s
+++ lld/test/ELF/no-inhibit-exec.s
@@ -5,6 +5,8 @@
# RUN: llvm-objdump -d %t2 | FileCheck %s
# RUN: llvm-readobj -r %t2 | FileCheck %s --check-prefix=RELOC
+# RUN: ld.lld %t -w --noinhibit-exec -o /dev/null 2>&1 | count 0
+
# CHECK: Disassembly of section .text:
# CHECK-EMPTY:
# CHECK-NEXT: _start
Index: lld/docs/ld.lld.1
===================================================================
--- lld/docs/ld.lld.1
+++ lld/docs/ld.lld.1
@@ -358,6 +358,9 @@
Report unresolved symbols even if the linker is creating a shared library.
.It Fl -no-warn-symbol-ordering
Do not warn about problems with the symbol ordering file or call graph profile.
+.It Fl -no-warnings , Fl w
+Suppress warnings and cancel
+.Cm --fatal-warnings.
.It Fl -no-whole-archive
Restores the default behavior of loading archive members.
.It Fl -no-pie , Fl -no-pic-executable
Index: lld/docs/ReleaseNotes.rst
===================================================================
--- lld/docs/ReleaseNotes.rst
+++ lld/docs/ReleaseNotes.rst
@@ -31,6 +31,8 @@
* ``--compress-debug-sections=zstd`` is now available to compress debug
sections with zstd (``ELFCOMPRESS_ZSTD``).
(`D133548 <https://reviews.llvm.org/D133548>`_)
+* ``--no-warnings``/``-w`` is now available to suppress warnings.
+ (`D136569 <https://reviews.llvm.org/D136569>`_)
Breaking changes
----------------
Index: lld/ELF/Options.td
===================================================================
--- lld/ELF/Options.td
+++ lld/ELF/Options.td
@@ -297,6 +297,9 @@
def no_undefined: F<"no-undefined">,
HelpText<"Report unresolved symbols even if the linker is creating a shared library">;
+def no_warnings: FF<"no-warnings">, HelpText<"Suppress warnings and cancel --fatal-warnings">;
+def : Flag<["-"], "w">, Alias<no_warnings>, HelpText<"Alias for --no-warnings">;
+
def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
HelpText<"Path to file to write output">;
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -542,7 +542,9 @@
// Interpret these flags early because error()/warn() depend on them.
errorHandler().errorLimit = args::getInteger(args, OPT_error_limit, 20);
errorHandler().fatalWarnings =
- args.hasFlag(OPT_fatal_warnings, OPT_no_fatal_warnings, false);
+ args.hasFlag(OPT_fatal_warnings, OPT_no_fatal_warnings, false) &&
+ !args.hasArg(OPT_no_warnings);
+ errorHandler().suppressWarnings = args.hasArg(OPT_no_warnings);
checkZOptions(args);
// Handle -help
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136569.470222.patch
Type: text/x-patch
Size: 3289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221024/16d3ef3f/attachment.bin>
More information about the llvm-commits
mailing list