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: Thiemo Seufer <ica2_ts at csv dot ica dot uni-stuttgart dot de>
- To: binutils at sources dot redhat dot com
- Date: Tue, 10 Jun 2003 22:21:07 +0200
- Subject: Re: MIPS patch to correct the size of %neg() fixups
- References: <wvnd6hl6711.fsf@talisman.cambridge.redhat.com>
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.
That's probably a too simple approach for the genaral case, since e.g. a
R_MIPS_GPREL(sym)
R_MIPS_64(null)
sequuence is supposed to produce a 64bit addend. AFAICS the relocation
field size in all relocations of a triple should be the largest one
encountered there.
Thiemo