This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: mips 64-bit address generation is broken.
- From: cgd at broadcom dot com
- To: "Maciej W. Rozycki" <macro at ds2 dot pg dot gda dot pl>
- Cc: ica2_ts at csv dot ica dot uni-stuttgart dot de,binutils at sources dot redhat dot com
- Date: 18 Feb 2002 11:44:36 -0800
- Subject: Re: mips 64-bit address generation is broken.
- References: <Pine.GSO.3.96.1020218195451.13485O-100000@delta.ds2.pg.gda.pl>
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