This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] MIPS/gas: load/store address overflow on binutils 2.14


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        +


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]