[PATCH] gas/symbols: do not panic upon resolving O_md
Alan Modra
amodra@gmail.com
Sat Jul 16 02:02:24 GMT 2022
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
More information about the Binutils
mailing list