MIPS %half in gas
Richard Sandiford
rsandifo@nildram.co.uk
Fri Oct 12 17:48:00 GMT 2007
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.
Richard
More information about the Binutils
mailing list