MIPS %half in gas
Maciej W. Rozycki
macro@linux-mips.org
Mon Oct 15 12:49:00 GMT 2007
On Fri, 12 Oct 2007, Richard Sandiford wrote:
> > + if (fixP->fx_done)
> > + {
> > + if (*valP & ~0xffffull)
> > + {
> > + char value [32];
> > +
> > + sprintf_vma (value, *valP);
> > + as_bad_where (fixP->fx_file, fixP->fx_line,
> > + _("Number (0x%s) larger than 16 bits"), value);
> > + }
> > +
> > + if (target_big_endian)
> > + buf += 2;
> > + md_number_to_chars ((char *) buf, *valP, 2);
> > + }
> > + break;
> > +
>
> Regarding the discussion downthread, the ABI specifically says that an
> R_MIPS_16 addend is signed rather than an unsigned, so (a) it really should
> be OK to use %half for ADDIU and LW, and (b), the *valP check above probably
> needs to check a signed range rather than an unsigned one, or at least
> allow both.
Fair enough. I only complained about the way of use in the test case,
because the code above clearly treats the addend as unsigned. I have had
a look at the ABI document now and it documents a half16 relocatable field
together with its associated R_MIPS_16 relocation like you say. Although
no indication there as to what it would be useful for.
Maciej
More information about the Binutils
mailing list