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


Maciej W. Rozycki wrote:
> 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.

Huh? gcc provides input for the assembler, it will never see what
happens here.

> > +  /* 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;

IIRC X_add_number is unsigned.

> 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!). 

What's the meaning of a negative address?


Thiemo


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