[PATCH 1/2] opcodes/mips: use .word/.short for undefined instructions
Maciej W. Rozycki
macro@orcam.me.uk
Fri Jan 6 15:58:08 GMT 2023
Hi Andrew,
In the course of reviewing outstanding upstream mailing list traffic I
came across this change of yours.
On Thu, 3 Nov 2022, Andrew Burgess via Binutils wrote:
> diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
> index faeebccfc3b..1d9875f2bb0 100644
> --- a/opcodes/mips-dis.c
> +++ b/opcodes/mips-dis.c
> @@ -2515,7 +2515,10 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info)
> }
> }
>
> - infprintf (is, "0x%x", insn);
> + if (length == 2)
> + infprintf (is, ".short\t0x%x", insn);
> + else
> + infprintf (is, ".word\t0x%x", insn);
FYI, I find this questionable as `.word' (at least with the MIPS target)
implies natural alignment while 32-bit microMIPS encodings, valid or not,
are not. Also, given the endianness peculiarity (analogous to the MIPS16
extended encodings), I think this needs to be ".short\t0x%x, 0x%x" really,
with the instruction word split into halfwords for any reasonable meaning.
This is already reflected in the raw hex dump of instruction streams; the
numbers printed need to match it.
With the naked number previously used this obviously didn't matter as it
stood out without any attempt to pretend to have a meaning. This is also
the reason why I chose to keep it as it used to be since forever.
FWIW,
Maciej
More information about the Binutils
mailing list