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