[patch] adjust libgloss addresses for 64-bit

Maciej W. Rozycki macro@linux-mips.org
Fri Apr 15 18:56:00 GMT 2005

On Fri, 15 Apr 2005, Paul Koning wrote:

> So DLI loads a 64 bit int and LI a 32 bit int.  DLA loads a 64 bit
> address and LA a 32 bit address.  So the operand of LA should be a
> construct that is a valid 32 bit address (and 0x80000000 is one such)
> and it should be expanded into instructions that produce a valid
> representation of that address in a register (i.e., with sign
> extension if the registers are 64 bits).

 With, "li" vs "dli" the definition is rather obvious and unambiguous.  
It's not with "la" vs "dla".  With the (n)64 ABI what should the 
following macros expand to:

la	$2, 0x80000000
la	$2, 0x80000000($3)
la	$2, foo + 0x80000000($3)
la	$2, foo + 0xc000000080000000($3)

In particular, assuming the RHS operand is sign-extended, should "sll $2, 
$3, 0" be performed as a part of the three latters?  What about "foo"?  
Or the 64-bit offset?

 But in principle you are right for consistency the presence or the lack 
of the "d" prefix should imply the size of the operands used as it is so 
for other assembly instructions.  So how about disabling the "wrong" 
macros completely?  That is using as_bad() for these two "dla/la used to 
load..." messages just below "do_la" that are currently warnings.  After 
all these load address macros are the only place where non-default address 
calculation rules can be argued about at all -- the interpretation of 

lh	$2, 0x80000000
lh	$2, 0x80000000($3)
lh	$2, foo + 0x80000000($3)
lh	$2, foo + 0xc000000080000000($3)

is rather out of question, isn't it?


More information about the Newlib mailing list