reloc overflows

Ian Lance Taylor ian@zembu.com
Sat Mar 11 10:17:00 GMT 2000


   Date: Sat, 11 Mar 2000 13:02:04 +1030 (CST)
   From: Alan Modra <alan@SPRI.Levels.UniSA.Edu.Au>

   Moving the hack up a little will cure the problem by
   effectively saying that if bits_per_address == 32 then a 32-bit bitfield
   reloc can't overflow (which is what you get when compiling with a 32-bit
   bfd).  I don't particularly like this solution though as we might as well
   remove all the bitfield overflow checking.

I think that might be right, though.  We won't actually be removing
the overflow checking.  We will only be removing the overflow checking
for a 32 bit relocation.  I think that might be right.  If
bits_per_address == 32, then a 32 bit bitfield relocation can't really
overflow.

   My alternative solution, which also fixes the 16-bit reloc problem, is to
   say that a bitfield reloc of n bits can represent numbers in the range
   -(2**n) to 2**n-1.  The current range allowed is -(2**(n-1)) to 2**n-1,
   ie. overlap of n bit signed and unsigned numbers.

   What do you all think of this?

I guess I can see some logic to that.

Ian


More information about the Binutils mailing list