[PATCH v4 0/2] RISC-V: Fix display of partial instructions

Nelson Chu nelson@rivosinc.com
Thu Jan 9 02:15:37 GMT 2025


Thanks Charlie for working on this.  Already passed regressions and
committed.

Nelson

On Wed, Jan 8, 2025 at 5:35 AM Charlie Jenkins <charlie@rivosinc.com> wrote:

> When testing linux perf, I noticed that this behavior of objdump has
> changed. Before this patch and running `perf test` on riscv the
> following test fails due to objdump not returning all of the expected
> bytes.
>
> Bytes read differ from those read by objdump
> buf1 (dso):
> 0x97 0xf7 0x11 0x00 0x93 0x87 0xc7 0x7c 0x22 0x85 0x7c 0xec 0xef 0x50 0x80
> 0x12
> 0xa6 0x85 0xce 0x86 0x4a 0x86 0x22 0x85 0xef 0x50 0x40 0x40 0xa2 0x84 0x1d
> 0xc9
> 0x7c 0x58 0x85 0x8b 0x85 0xc3 0x1c 0x40 0xa1 0x8b 0x89 0xcf 0x83 0x27 0x04
> 0x0c
> 0x63 0x51 0xf0 0x04 0x97 0xf7 0x11 0x00 0x93 0x87 0x07 0x45 0xbe 0x86 0x58
> 0x70
> 0x74 0xec 0x7c 0xf3 0xa2 0x70 0x02 0x74 0x42 0x69 0xa2 0x69 0x26 0x85 0xe2
> 0x64
> 0x45 0x61 0x82 0x80 0x22 0x85 0xef 0x50 0x50 0x52 0x22 0x85 0xef 0x00 0xb1
> 0x39
> 0xa2 0x70 0x02 0x74 0x81 0x44 0x42 0x69 0xa2 0x69 0x26 0x85 0xe2 0x64 0x45
> 0x61
> 0x82 0x80 0x97 0x06 0x12 0x00 0x93 0x86 0xa6 0x8a 0x97 0xf7 0x11 0x00 0x93
> 0x87
>
> buf2 (objdump):
> 0x97 0xf7 0x11 0x00 0x93 0x87 0xc7 0x7c 0x22 0x85 0x7c 0xec 0xef 0x50 0x80
> 0x12
> 0xa6 0x85 0xce 0x86 0x4a 0x86 0x22 0x85 0xef 0x50 0x40 0x40 0xa2 0x84 0x1d
> 0xc9
> 0x7c 0x58 0x85 0x8b 0x85 0xc3 0x1c 0x40 0xa1 0x8b 0x89 0xcf 0x83 0x27 0x04
> 0x0c
> 0x63 0x51 0xf0 0x04 0x97 0xf7 0x11 0x00 0x93 0x87 0x07 0x45 0xbe 0x86 0x58
> 0x70
> 0x74 0xec 0x7c 0xf3 0xa2 0x70 0x02 0x74 0x42 0x69 0xa2 0x69 0x26 0x85 0xe2
> 0x64
> 0x45 0x61 0x82 0x80 0x22 0x85 0xef 0x50 0x50 0x52 0x22 0x85 0xef 0x00 0xb1
> 0x39
> 0xa2 0x70 0x02 0x74 0x81 0x44 0x42 0x69 0xa2 0x69 0x26 0x85 0xe2 0x64 0x45
> 0x61
> 0x82 0x80 0x97 0x06 0x12 0x00 0x93 0x86 0xa6 0x8a 0x97 0xf7 0x11 0x00 0xad
> 0x00
>
> ---- end(-1) ----
>  24: Object code reading                              : FAILED!
>
> After this patch, this test case no longer fails, as objdump returns the
> expected values.
>
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
>
> ---
> Changes in v4:
> - Added test cases
> - Changed wording of "disassembly" to "display" (Jan)
> - Link to v3:
> https://lore.kernel.org/r/20241219-fix_objdump_partial_insn-v3-1-d5ed9af878d1@rivosinc.com
>
> Changes in v3:
> - More formatting issues (Nelson)
> - Link to v2:
> https://lore.kernel.org/r/20241216-fix_objdump_partial_insn-v2-1-8de88a115dbc@rivosinc.com
>
> Changes in v2:
> - Fix comment spacing (Jiawei)
> - Link to v1:
> https://lore.kernel.org/r/20241213-fix_objdump_partial_insn-v1-1-7a4963e655d5@rivosinc.com
>
> ---
> Charlie Jenkins (2):
>       RISC-V: Fix display of partial instructions
>       RISC-V: Add partial instruction display tests
>
>  gas/testsuite/gas/riscv/dis-partial-insn-byte.d  | 11 +++++
>  gas/testsuite/gas/riscv/dis-partial-insn-short.d | 11 +++++
>  gas/testsuite/gas/riscv/dis-partial-insn-word.d  | 11 +++++
>  gas/testsuite/gas/riscv/dis-partial-insn.s       |  2 +
>  opcodes/riscv-dis.c                              | 53
> ++++++++++++++++++++++--
>  5 files changed, 84 insertions(+), 4 deletions(-)
> ---
> base-commit: 978324718990b6b371d4eeeba02cfe13a0ebf120
> change-id: 20241121-fix_objdump_partial_insn-94e236f3db38
> --
> - Charlie
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/binutils/attachments/20250109/dc917d97/attachment.htm>


More information about the Binutils mailing list