From: Alan Modra <amodra@gmail.com>
To: Charlie Jenkins <charlie@rivosinc.com>
Cc: jiawei <jiawei@iscas.ac.cn>, Nelson Chu <nelson@rivosinc.com>,
Jan Beulich <jbeulich@suse.com>,
Andrew Burgess <aburgess@redhat.com>,
gdb-patches <gdb-patches@sourceware.org>,
Binutils <binutils@sourceware.org>
Subject: Re: [PATCH 1/2] RISC-V: Fix abort when displaying .dword
Date: Wed, 12 Feb 2025 17:55:16 +1030 [thread overview]
Message-ID: <Z6xM3H6gnZEahP3E@squeak.grove.modra.org> (raw)
In-Reply-To: <20250211-fix_gas_abort-v1-1-afd9730f9c51@rivosinc.com>
On Tue, Feb 11, 2025 at 09:08:30PM -0800, Charlie Jenkins wrote:
> In the normal case an instruction won't be split into 5, 6, or 7 byte
> sections. However a .dword disassembled with -D can cause an instruction
> to split across the 6 byte boundary. 6 byte instructions were not
> supported so riscv_disassemble_data() would abort.
I think it is worse than just needing to cope with 5, 6, or 7 bytes.
riscv-dis.c:1444 sets dump_size from riscv_insn_length which
looks like it can be up to 22 bytes. A carefully constructed testcase
that gets this value from riscv_insn_length but then has only 20
bytes in the section will result in riscv_disassemble_data being
called with bytes_per_chunk of 20.
cat > xxx.s <<EOF
.byte 0x7f,0xef,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
EOF
gas/as-new -o xxx.o xxx.s
binutils/objcopy --strip-symbol '$d' xxx.o xx.o
binutils/objdump -d xx.o
--
Alan Modra
next prev parent reply other threads:[~2025-02-12 7:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 5:08 [PATCH 0/2] RISC-V: Fix abort when displaying data and add test Charlie Jenkins
2025-02-12 5:08 ` [PATCH 1/2] RISC-V: Fix abort when displaying .dword Charlie Jenkins
2025-02-12 5:27 ` Jiawei
2025-02-12 7:25 ` Alan Modra [this message]
2025-02-12 8:06 ` Jan Beulich
2025-02-12 8:57 ` Nelson Chu
2025-02-12 10:06 ` Jan Beulich
2025-02-12 22:15 ` Maciej W. Rozycki
2025-02-13 0:51 ` Charlie Jenkins
2025-02-13 0:52 ` Charlie Jenkins
2025-02-12 5:08 ` [PATCH 2/2] RISC-V: Add testcase for 6 byte instruction Charlie Jenkins
2025-02-12 5:20 ` [PATCH 0/2] RISC-V: Fix abort when displaying data and add test Nelson Chu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z6xM3H6gnZEahP3E@squeak.grove.modra.org \
--to=amodra@gmail.com \
--cc=aburgess@redhat.com \
--cc=binutils@sourceware.org \
--cc=charlie@rivosinc.com \
--cc=gdb-patches@sourceware.org \
--cc=jbeulich@suse.com \
--cc=jiawei@iscas.ac.cn \
--cc=nelson@rivosinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox