This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: MIPS patch to correct the size of %neg() fixups
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Richard Sandiford <rsandifo at redhat dot com>
- Cc: binutils at sources dot redhat dot com, echristo at redhat dot com
- Date: Wed, 11 Jun 2003 09:25:55 -0400
- Subject: Re: MIPS patch to correct the size of %neg() fixups
- References: <wvnd6hl6711.fsf@talisman.cambridge.redhat.com>
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