[ping][PATCH] MIPS/GAS: LUI operand handling bug fixes

Maciej W. Rozycki macro@codesourcery.com
Mon Nov 5 14:38:00 GMT 2012


On Fri, 2 Nov 2012, Richard Sandiford wrote:

> >  I think this begs for the overflow checks I mentioned the other day too, 
> > a piece like:
> >
> > 	addiu	$4,$4,foo+1
> > 	.eqv	foo,0x12345678
> >
> > should IMHO fail -- do you agree?  I.e. use %lo if this is supposed not to 
> > overflow:
> >
> > 	addiu	$4,$4,%lo(foo+1)
> > 	.eqv	foo,0x12345678
> 
> Yeah, I wondered about that too, but I don't think we should change it.
> If we were starting from scratch, then I agree that it would make sense
> to raise the error, but changing it now (after 20ys+ history) seems
> as likely to harm as help.  Let's just fix the bogus LUI output.

 Well, not quite from 20yrs ago, the lack of an error with the former 
example is an unfortunate side effect of the recent %hi/%lo fix -- exactly 
where I noted the need for better overflow handling.  I get this:

addiu.s: Assembler messages:
addiu.s:1: Error: relocation overflow

with arbitrarily picked version 2.20.1, so I think first we can (and 
should) bring it back and second enforce it for LUI as well (well, with 
what I have in mind that'll be automatic).  Do you still think we have to 
avoid such checks?

  Maciej



More information about the Binutils mailing list