This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: "Error: constant too large" on mips gas
>
> Well, with "-mabi=32" or "-mabi=n32" I get:
>
> lui $2,0x8000
>
> and with "-mabi=64" I get:
>
> ori $2,$0,0x8000
> dsll $2,$2,0x10
>
> (and a warning about "la" being used with a 64-bit address). I do believe
> this is exactly what is desired. I'm afraid for "-mabi=64" you are
> expected to specify "0xffffffff80000000" explicitly -- there are no
> excuses.
Fair enough. It does appear to work in 32-bit mode as well. There's been
some discussion on this that we should automatically sign extend
constants that are loaded as an address.
> Well, no code example as I haven't touched it yet, but semantically-wise
> I think calls to expr() should should be able to specify the width of the
> ALU word to operate on and whether to treat literals as signed or not.
> Then any literal will get internally either zero- or sign-extended from
> the specified width to the width of the internal representation (i.e that
> of offsetT) as will any results produced. Encountering a literal wider
> than the specified width should probably result in treating it as O_big.
>
This is close to what I was thinking of yesterday. One thought was that
any literal that comes in as a "load address" should be considered to be
sign extended to the size of the register, and a "load register" should
be zero extended.
> I have no written document available of any kind, but I can surely
> provide feedback.
OK.
-eric