public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Sam James <sam@gentoo.org>
To: Nick Clifton <nickc@redhat.com>
Cc: serge.guelton@telecom-bretagne.eu, binutils@sourceware.org
Subject: Re: RFC: Document unexpected behaviour of --fatal-warnings
Date: Wed, 24 Jan 2024 15:13:24 +0000	[thread overview]
Message-ID: <87frymkbl0.fsf@gentoo.org> (raw)
In-Reply-To: <87fryomdy6.fsf@redhat.com>


Nick Clifton <nickc@redhat.com> writes:

> Hi Guys,

Hi Nick,

>
>   It was recently pointed out to me that the bfd linker's
>   --fatal-warnings option can behave in an unexpected manner.  For
>   example:
>
>     $ ld.bfd -z bad-option --fatal-warnings -e 0/dev/null
>     ld.bfd: warning: -z bad-option ignored
>     $ echo $?
>     0
>
>   ie the warning about the ignored option is not being treated as an
>   error.  This happens because the --fatal-warnings option only takes
>   affect after it has been processed, and we process the options in a
>   linear order.  So the following works:
>
>     $ ld.bfd --fatal-warnings -z bad-option -e 0 /dev/null
>     ld.bfd: warning: -z bad-option ignored
>     $ echo $?
>     1
>
>   This behaviour differs from gold and lld, both of which honour
>   --fatal-warnings no matter where it occurs on the command line.
>
>   So we could fix the linker, create a two pass argument scan and the
>   problem would be solved.  But a) I am lazy and b) we already have a
>   precedent for options on the command line only affecting options that
>   come after it.  (I am thinking of the -L option here, although there
>   are probably several others).  So instead I am considering documenting
>   the current behaviour as expected.  (See the patch below).
>
>   What do people think ?

I'm OK with it either way. We're really used to this kind of linker
behaviour so it's not a problem to just document it. I've not hit
this as a problem at all.

Then if someone wants to improve it later on, so be it.

(We could maybe change the docs to say "may not affect" if we want
leeway to change it later.)

>
> Cheers
>   Nick
>

thanks,
sam

  parent reply	other threads:[~2024-01-24 15:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 12:28 Nick Clifton
2024-01-23 12:38 ` Jan Beulich
2024-01-23 12:50   ` H.J. Lu
2024-01-23 13:15     ` H.J. Lu
2024-01-24 15:07 ` Serge Guelton
2024-01-24 15:13 ` Sam James [this message]
2024-01-24 16:06   ` H.J. Lu
2024-01-24 22:52     ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87frymkbl0.fsf@gentoo.org \
    --to=sam@gentoo.org \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    --cc=serge.guelton@telecom-bretagne.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).