[patch] adjust libgloss addresses for 64-bit

Thiemo Seufer ths@networkno.de
Thu Apr 14 22:38:00 GMT 2005

Eric Christopher wrote:
> Here's another shot at this. The problem that we encounter is that for
> 64-bit addresses "la" (or dla for that matter) does not sign extend the
> constant passed in the case of:
> la $2,0x80000000
> leaving us with a zero-extended value in a register which is
> unpredictable as far as the standard (and at least one chip out there)
> is concerned. One option would be to modify the assembler to
> automatically sign-extend when in the presence of constants that are
> smaller than a single register.

I think la should load a proper address for 32bit address space, even
when used in code with 64bit addresses. That's the most useful
behaviour for it.

> Not a bad idea, but we should also just be precise in what we pass as
> well. Since gas will accept sign extended constants from la when we're
> using a 64-bit pointers we can probably get by with this patch as well.

FWIW, the Linux kernel uses this approach for a while now.


More information about the Newlib mailing list