This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [patch] MIPS/gas: load/store address overflow on binutils 2.14
- From: "Maciej W. Rozycki" <macro at ds2 dot pg dot gda dot pl>
- To: Thiemo Seufer <ica2_ts at csv dot ica dot uni-stuttgart dot de>
- Cc: binutils at sources dot redhat dot com, Atsushi Nemoto <anemo at mba dot ocn dot ne dot jp>
- Date: Fri, 12 Sep 2003 15:37:22 +0200 (MET DST)
- Subject: Re: [patch] MIPS/gas: load/store address overflow on binutils 2.14
- Organization: Technical University of Gdansk
On Fri, 12 Sep 2003, Thiemo Seufer wrote:
> I took a different approach by sign-extending all constants. I think this
> is more consistent with the rest of binutils MIPS support (sign-extend
> and truncate if appropriate). It also handles the ldst_constoffset case
> and removes some more complicated sign-extension tests.
It looks like a good idea, except that I'd do sign extension differently
-- to let gcc know what we really mean.
> + /* Sign-extending 32-bit constants makes their handling easier. */
> + if (! dbl
> + && (ep->X_add_number & 0x80000000)
> + && ! (ep->X_add_number & ~(offsetT) 0xffffffff))
> + ep->X_add_number |= ~(offsetT) 0xffffffff;
Like this:
if (! dbl && (! (ep->X_add_number & ~(offsetT) 0xffffffff))
&& ! (-ep->X_add_number & ~(offsetT) 0xffffffff)))
ep->X_add_number = (ep->X_add_number << 32) >> 32;
This might need checking for BFD64 though. The second check of
ep->X_add_number is needed to handle cases like "lw $2,-0xf0000000" (try
it out!).
Maciej
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +