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: MIPS patch to correct the size of %neg() fixups


On Tue, Jun 10, 2003 at 08:56:26PM +0100, Richard Sandiford wrote:
> This code:
> 
> foo:
> 	lui	$2,%hi(%neg(%gp_rel(foo)))
> 	sub	$sp,$sp,28
> 
> causes an internal error:
> 
>     /tmp/abort.s:2: Error: internal error: fixup not contained within frag
> 
> gas is creating a separate fixup for the each relocation operator
> in the first instruction.  The size of the fixup is determined
> by the corresponding relocation's howto.
> 
> Problem is, R_MIPS_SUB is a 64-bit relocation, so it gets a 64-bit
> fixup.  The "sub" macro then forces the start of a new frag, so the
> R_MIPS_SUB fixup goes beyond the end of the old frag.
> 
> As I understand it, the relocation field should be determined
> by the outermost operator (%hi() in this case) and all three
> fixups should use that size.
> 
> Also, the handling of the second and third operators in a compound
> relocation had this code cut&paste from the first:
> 
> 		  /* These relocations can have an addend that won't fit in
> 		     4 octets for 64bit assembly.  */
> 		  if (HAVE_64BIT_GPRS
> 		      && ! howto->partial_inplace
> 		      && (reloc_type[1] == BFD_RELOC_16
>                           ...
> 
> I think this is unnecessary because both fixups have an addend of zero.
> 
> Patch tested on mips-sgi-irix6.5 and mips64-elf.  No regressions.
> OK to install?
> 
> Daniel: if possible, I'd really like this to go into 2.14.
> It's needed to bootstrap gcc 3.4 on irix.

That sounds reasonable.  I'll hold 2.14 for this; it's otherwise about
ready.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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