[PATCH] RISC-V: don't disassemble unrecognized insns as .byte
Nelson Chu
nelson@rivosinc.com
Tue Jan 31 01:51:04 GMT 2023
On Mon, Jan 30, 2023 at 11:33 AM Maciej W. Rozycki <macro@orcam.me.uk> wrote:
>
> Hi Nelson,
>
> > 0000000000000000 <.text>:
> > 0: 0001 .short 0x0001
> > 2: 0001 .2byte 0x1
> > 4: 0001 .short 0x0001
> > ...
> >
> > The .<N>byte in assembly will also be treated as data to dump, so
> > ideally, dump these unrecognized instructions as .insn is probably
> > more reasonable and won't be confused.
>
> I wasn't aware about the RISC-V `.insn' pseudo-op. I think it will make
> a lot of sense to use it here then, so I'd be happier with either:
>
> 2: 0001 .insn 0x0001
>
> or:
>
> 2: 0001 .insn 0x2, 0x1
>
> and analogously for unrecognised instructions comprised of a higher number
> of parcels according to the opcode allocation, e.g.:
>
> Disassembly of section .text:
> 0000000000000000 <foo> .insn 0x00000000001f
>
> or:
>
> Disassembly of section .text:
> 0000000000000000 <foo> .insn 0x6, 0x1f
>
> (here in the `--prefix-addresses' format). The single-argument format may
> by clearer to the casual eye at the cost of extra leading zeros with some
> encodings.
Yeah, dump these unrecognized instructions into the .insn directives
with the <bytes> field looks better. Thanks for pointing this out :-)
Nelson
More information about the Binutils
mailing list