From: Alan Modra <amodra@gmail.com>
To: Dmitry Selyutin <ghostmansd@gmail.com>
Cc: Binutils <binutils@sourceware.org>,
Luke Kenneth Casson Leighton <luke.leighton@gmail.com>
Subject: Re: [PATCH] gas/symbols: do not panic upon resolving O_md
Date: Sat, 16 Jul 2022 11:32:24 +0930 [thread overview]
Message-ID: <YtIcMOWJN4KcJ0wz@squeak.grove.modra.org> (raw)
In-Reply-To: <CAMqzjev0i46cEZJYbH9kuwuPMhCEWDJosfBuMxzom7yf0NhY1Q@mail.gmail.com>
On Fri, Jul 15, 2022 at 08:13:01AM +0300, Dmitry Selyutin wrote:
> On Fri, Jul 15, 2022, 07:50 Alan Modra <amodra@gmail.com> wrote:
>
> > On Fri, Jul 15, 2022 at 12:26:52AM +0300, Dmitry Selyutin wrote:
> > > + case O_md1...O_md32:
> >
> > Please don't use gcc extensions.
> >
>
> My initial impression was that the code uses them (e.g. ATTRIBUTE_UNUSED).
> But OK, actually the first thing I did was a simple "if" in the default
> section; I only thought that ranges would be more evident. Alternatively,
> we could have a bunch of O_md cases; 32 cases with just a simple break
> might be way too much, though. With md_resolve_symbol this makes more
> sense, I think.
>
> > This might avoid the fatal error, but will still hit an error later
> > due to resolved not being set.
>
>
> I assume you mean symbol->flags.resolving = 0, right? If so, this is set
> after the switch (including this break).
No, I mean what I said.
if (resolved)
symp->flags.resolved = 1;
else if (S_GET_SEGMENT (symp) != expr_section)
{
as_bad (_("can't resolve value for symbol `%s'"),
S_GET_NAME (symp));
symp->flags.resolved = 1;
}
> I think this calls for an
> > md_resolve_symbol.
> >
>
> Do you mean letting the caller define this as macro? I suggest calling it
> in "default:" section then, with the corresponding ifdef check.
--
Alan Modra
Australia Development Lab, IBM
next prev parent reply other threads:[~2022-07-16 2:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 21:26 Dmitry Selyutin
2022-07-15 4:50 ` Alan Modra
2022-07-15 5:13 ` Dmitry Selyutin
2022-07-16 2:02 ` Alan Modra [this message]
2022-07-18 9:35 ` Dmitry Selyutin
2022-07-18 9:46 ` [PATCH] gas/symbols: introduce md_resolve_symbol Dmitry Selyutin
2022-07-20 3:06 ` Alan Modra
2022-07-20 13:21 ` Dmitry Selyutin
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=YtIcMOWJN4KcJ0wz@squeak.grove.modra.org \
--to=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=ghostmansd@gmail.com \
--cc=luke.leighton@gmail.com \
/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).