This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: MIPS %half in gas
- From: Thiemo Seufer <ths at networkno dot de>
- To: binutils at sourceware dot org, rsandifo at nildram dot co dot uk
- Date: Fri, 12 Oct 2007 18:57:37 +0100
- Subject: Re: MIPS %half in gas
- References: <1096932306.3676.43.camel@localhost.localdomain> <20041005014927.GA26907@nevyn.them.org> <20071012154340.GC9046@caradoc.them.org> <87k5pscjhn.fsf@firetop.home>
Richard Sandiford wrote:
> Daniel Jacobowitz <drow@false.org> writes:
> > + case BFD_RELOC_16:
> > + /* If we are deleting this reloc entry, we must fill in the
> > + value now. This can happen if we have a .word which is not
> > + resolved when it appears but is later defined. */
>
> Minor nit, but this comment is for BFD_RELOC_16 in isolation, which can
> never come from a .word directive. I think you should just generalise
> ".word" to "instruction", or something like that.
>
> > + 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.
Indeed, I missed the signedness here.
Thiemo