32-bit archs, want64=true, and gas integers

Jan Beulich jbeulich@suse.com
Fri May 6 11:55:55 GMT 2022


On 06.05.2022 12:43, Pedro Alves wrote:
> I've never looked at gas code before, but I found the the code that parses integers,
> and it seems to automatically handle integers larger than 64-bit, by promoting to bignum.
> Maybe the ideal or the original intent was for integers to behave as as they had unlimited
> precision,

Well, not unlimited, but far higher.

> with non-bignum integers being an optimization?  And then make sure that all
> operations, including division would handle bignums too?

Don't know. To me the limitations of bignum don't look as if that might
have been the plan.

> Anyhow, here's a tentative patch of what I was imagining.  I'm not set up for testing
> this properly.  I was hoping one of you guys would like the idea so much that
> you'd run with it.  :-)

It look plausible at the first glance, but ...

> If something like this went in, then I assume that cris could go back to not setting
> want64=yes.
> 
> From 7fbbecc9eacd7e5dac076bfc25b099b9ff0ca1ac Mon Sep 17 00:00:00 2001
> From: Pedro Alves <pedro@palves.net>
> Date: Fri, 6 May 2022 11:15:11 +0100
> Subject: [PATCH] gas: make non-bignum integers be always 64-bit
> 
> Currently, on 32-bit hosts, gas integers are either 32-bit or 64-bit,
> depending on --enable-64-bit-bfd.  Make valueT be always uint64_t to
> make gas behave the same on all hosts.
> 
> Change-Id: I6258dfcd975ea9abb9cc4eb1d4e604a077df3033
> ---
>  gas/as.h   |  2 +-
>  gas/expr.c | 65 ++++++++++++++----------------------------------------
>  gas/expr.h |  1 -
>  3 files changed, 18 insertions(+), 50 deletions(-)
> 
> diff --git a/gas/as.h b/gas/as.h
> index 135abc8f23d..5b636cfd59a 100644
> --- a/gas/as.h
> +++ b/gas/as.h
> @@ -139,7 +139,7 @@ typedef bfd_vma addressT;
>  typedef bfd_signed_vma offsetT;
>  
>  /* Type of symbol value, etc.  For use in prototypes.  */
> -typedef addressT valueT;
> +typedef uint64_t valueT;

... I'd be afraid this might alter behavior for purely 32-bit targets.
Whether such a behavioral change would be deemed okay I'm not sure.

Jan



More information about the Binutils mailing list