mips 64-bit address generation is broken.

cgd@broadcom.com cgd@broadcom.com
Mon Feb 18 12:17:00 GMT 2002


At Mon, 18 Feb 2002 20:33:40 +0100 (MET), Maciej W. Rozycki wrote:
>  "dla" should probably be discouraged (or maybe even forbidden) for 32-bit
> objects (see also my comments in
> 'http://sources.redhat.com/ml/binutils/2002-02/msg00532.html' and
> follow-ups).  And similarly for "la" and 64-bit objects.

You are incorrectly assuming that you can do that and not break a
_large_ amount of existing code.

There are a _lot_ of people out there using a model supported by the
GNU tools "forever":

	* 32-bit ELF

	* -mips3 or another 64-bit-GPR ISA.

	* -mlong64.


As you suggest, that compiles the example as:

> 2. For a 64-bit address width:
>
> ld      $2,q
> ld      $3,p
> dla     $2,131072($2)
> sltu    $2,$2,$3

(with my patch -- previously the compiler would produce 'la' which is
seems broken, so I tweaked the compiler...  Still working on testing
that patch.)

But that dla doesn't expand as you expect:

> where the "dla" expands to:
>
> lui     $1,0x2
> daddu   $2,$1

Because the object file is 32-bit, the assembler turns that dla into:

	lui	$reg1, 0x2
	addu	$breg, $reg1

Which loses.


> Using 64-bit addresses in 32-bit objects should be disallowed as they
> don't support them -- pretending it's otherwise would at least be
> confusing to a user and may lead to unpredictable behavior.

I'm glad you think so, but people have been using them with the GNU
tools _for years_ and have been depending on them for embedded
development work.



cgd



More information about the Binutils mailing list