From: Alan Modra <amodra@gmail.com>
To: Dmitry Selyutin <ghostmansd@gmail.com>
Cc: binutils@sourceware.org,
Luke Kenneth Casson Leighton <luke.leighton@gmail.com>
Subject: Re: [PATCH] gas/symbols: do not panic upon resolving O_md
Date: Fri, 15 Jul 2022 14:20:13 +0930 [thread overview]
Message-ID: <YtDyBZPmm0BZcqze@squeak.grove.modra.org> (raw)
In-Reply-To: <20220714212651.297902-1-ghostmansd@gmail.com>
On Fri, Jul 15, 2022 at 12:26:52AM +0300, Dmitry Selyutin wrote:
> Assuming GMSD is a special operand, marked as O_md1, the code:
>
> .set VREG, GMSD
> .set REG, VREG
> extsw REG, 2
>
> ...fails upon attempts to resolve the value of the symbol. This happens
> since machine-dependent values are not handled in the giant op switch.
>
> Machine-dependent expressions don't really need to be resolved, since
> the resolving process is really machine-dependent. We could have marked
> such symbols as resolving in port. However, we don't want to access
> the field which seems to be internal, and we especially don't want
> to perform this for each and every port.
> ---
> gas/symbols.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/gas/symbols.c b/gas/symbols.c
> index 6904a3102c..fd2117f7da 100644
> --- a/gas/symbols.c
> +++ b/gas/symbols.c
> @@ -1408,6 +1408,16 @@ resolve_symbol_value (symbolS *symp)
> BAD_CASE (op);
> break;
>
> + case O_md1...O_md32:
Please don't use gcc extensions.
> + /* Machine-dependent expressions don't really need
> + * to be resolved, since the resolving process is
> + * really machine-dependent. We could have marked
> + * such symbols as resolving in port. However, we
> + * don't want to access the field which seems to be
> + * internal, and we especially don't want to perform
> + * this for each and every port. */
> + break;
This might avoid the fatal error, but will still hit an error later
due to resolved not being set. I think this calls for an
md_resolve_symbol.
> +
> case O_absent:
> final_val = 0;
> /* Fall through. */
> --
> 2.37.0
--
Alan Modra
Australia Development Lab, IBM
next prev parent reply other threads:[~2022-07-15 4:50 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 [this message]
2022-07-15 5:13 ` Dmitry Selyutin
2022-07-16 2:02 ` Alan Modra
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=YtDyBZPmm0BZcqze@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).