Summary: | ld: add -w to suppress warnings | ||
---|---|---|---|
Product: | binutils | Reporter: | Fangrui Song <i> |
Component: | ld | Assignee: | Nick Clifton <nickc> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | nickc |
Priority: | P2 | ||
Version: | 2.40 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Attachments: | Proposed patch |
Description
Fangrui Song
2022-10-05 22:51:58 UTC
Created attachment 14403 [details]
Proposed patch
Hi Fanguri,
Is this patch the kind of thing that you had in mind ?
Cheers
Nick
(In reply to Nick Clifton from comment #1) > Created attachment 14403 [details] > Proposed patch > > Hi Fanguri, > > Is this patch the kind of thing that you had in mind ? > > Cheers > Nick Hi Nick, thanks for sending a patch! This looks good with just one thought: `config.fatal_warnings = false;` makes me wonder how -w interacts with --fatal-warnings. It seems that -w --fatal-warnings and --fatal-warnings -w have the same effect (-w wins, which makes sense IMO), so I guess `config.fatal_warnings = false;` can be omitted. The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4b2e7a577c2f7311a8c381ff791d46e654c41fcc commit 4b2e7a577c2f7311a8c381ff791d46e654c41fcc Author: Nick Clifton <nickc@redhat.com> Date: Fri Oct 21 12:20:09 2022 +0100 Add a -w option to the linker to suppress warning and error messages. PR 29654 * ld.h (struct ld_config_type): Add no_warnings field. * ldlex.h (enum option_values): Add OPTION_NO_WARNINGS. * lexsup.c (ld_options): Add --no-warnings. (parse_args): Add support for -w and --no-warnings. * ldmisc.c (vfinfo): Return early if the message is a warning and -w has been enabled. * ld.texi (options): Document new command line option. * NEWS: Mention the new feature. Hi Fangrui,
> `config.fatal_warnings = false;` makes me wonder how -w interacts with
> --fatal-warnings. It seems that -w --fatal-warnings and --fatal-warnings -w
> have the same effect (-w wins, which makes sense IMO), so I guess
> `config.fatal_warnings = false;` can be omitted.
It could, but I feel that it helps to emphasize that -w takes precedence over --fatal-warnings, so I have left it in.
Cheers
Nick
|