From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OMOACmExrGfS5isAWB0awg (envelope-from ) for ; Wed, 12 Feb 2025 00:28:01 -0500 Received: by simark.ca (Postfix, from userid 112) id 1D42A1E105; Wed, 12 Feb 2025 00:28:01 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6C7171E05C for ; Wed, 12 Feb 2025 00:27:58 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0CA793858420 for ; Wed, 12 Feb 2025 05:27:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0CA793858420 Received: from cstnet.cn (smtp84.cstnet.cn [159.226.251.84]) by sourceware.org (Postfix) with ESMTPS id B99F53858C60; Wed, 12 Feb 2025 05:27:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B99F53858C60 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=iscas.ac.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B99F53858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=159.226.251.84 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739338042; cv=none; b=dpoWIBJJRNNR0wwLKVHyIbo7H832ONDjY359/s9xzFXZ1ENRTrwsmsa/YWi+sWo8vzuv8qJNBs3QTrdLPXViqs+5oV2tn8kpDGYYtel/jhcUAjhRBfwf2ExhHY8T6VP2f8/5GAx1/dbNRkiSzdBcCXiOyZzhg240GH8ihJHexFM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739338042; c=relaxed/simple; bh=ft+fmQyqSG4Y7auukqWEDsS6/Wq8UxQH0CZevl+JLX4=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=m8pM7AanDHjg+IC38PfLIa5H156Ra958Np1/HSF9E/cVANTkr5RDfpIxTWKd//mD4lqf2EsU8sqp8oBkiKIchePq3fxwZhkZnj6cwxiuvIn0RY4lingf+b5KSnJB1soiDuqnz49IA9KKwWaQregr6BbGyjghFpYzErCmf5csAI4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B99F53858C60 Received: from [192.168.0.107] (unknown [157.0.80.211]) by APP-05 (Coremail) with SMTP id zQCowADX3io0MaxnlzdgDA--.44371S2; Wed, 12 Feb 2025 13:27:17 +0800 (CST) Message-ID: <843e2e5c-917c-4dec-b96c-c1cdc5ebd241@iscas.ac.cn> Date: Wed, 12 Feb 2025 13:27:07 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] RISC-V: Fix abort when displaying .dword To: Charlie Jenkins , Nelson Chu , Jan Beulich , Andrew Burgess Cc: gdb-patches , Binutils References: <20250211-fix_gas_abort-v1-0-afd9730f9c51@rivosinc.com> <20250211-fix_gas_abort-v1-1-afd9730f9c51@rivosinc.com> From: Jiawei In-Reply-To: <20250211-fix_gas_abort-v1-1-afd9730f9c51@rivosinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: zQCowADX3io0MaxnlzdgDA--.44371S2 X-Coremail-Antispam: 1UD129KBjvJXoWxAFy5Gry5Zw47ur45Cr18uFg_yoW5Xr17p3 sIgw4fGrW3tF4IkwnxAFyF9F43GFW8Cw45Kr47XrW8Ar17WF4jqFW7Jay09a13Cr1Igw15 XF45Xr17Cws5A37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkFb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I 8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI 64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8Jw Am72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lc7CjxVAaw2AFwI0_JF0_Jw1l42xK 82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGw C20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48J MIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMI IF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E 87Iv6xkF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07boDGrUUUUU= X-Originating-IP: [157.0.80.211] X-CM-SenderInfo: 5mld4v3l6l2u1dvotugofq/1tbiBgoLAGesIOkoCQAAsk X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org 在 2025/2/12 13:08, Charlie Jenkins 写道: > 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. > > Forcing instructions to be at most 4 bytes causes other unintented > side-effects, so instead add entries to the switch statement to handle > instructions that are 5, 6, or 7 bytes. > > Signed-off-by: Charlie Jenkins > Fixes: 6a04e8230707 ("RISC-V: Fix display of partial instructions") > --- > opcodes/riscv-dis.c | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > > diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c > index 367004d3341e46a5f72253cd70c7c2941912e84d..21bcbd32c7f226d13f1637ad192d8fe3c52e0d7a 100644 > --- a/opcodes/riscv-dis.c > +++ b/opcodes/riscv-dis.c > @@ -1325,6 +1325,33 @@ riscv_disassemble_data (bfd_vma memaddr ATTRIBUTE_UNUSED, > (info->stream, dis_style_immediate, "0x%08lx", > (unsigned long) data); > break; > + case 5: > + info->bytes_per_line = 8; > + (*info->fprintf_styled_func) > + (info->stream, dis_style_assembler_directive, ".dword"); > + (*info->fprintf_styled_func) (info->stream, dis_style_text, "\t"); > + (*info->fprintf_styled_func) > + (info->stream, dis_style_immediate, "0x%010lx", > + (unsigned long) data); > + break; > + case 6: > + info->bytes_per_line = 8; > + (*info->fprintf_styled_func) > + (info->stream, dis_style_assembler_directive, ".dword"); > + (*info->fprintf_styled_func) (info->stream, dis_style_text, "\t"); > + (*info->fprintf_styled_func) > + (info->stream, dis_style_immediate, "0x%012lx", > + (unsigned long) data); > + break; > + case 7: > + info->bytes_per_line = 8; > + (*info->fprintf_styled_func) > + (info->stream, dis_style_assembler_directive, ".dword"); > + (*info->fprintf_styled_func) (info->stream, dis_style_text, "\t"); > + (*info->fprintf_styled_func) > + (info->stream, dis_style_immediate, "0x%014lx", > + (unsigned long) data); > + break; > case 8: > info->bytes_per_line = 8; > (*info->fprintf_styled_func) > @@ -1332,7 +1359,7 @@ riscv_disassemble_data (bfd_vma memaddr ATTRIBUTE_UNUSED, > (*info->fprintf_styled_func) (info->stream, dis_style_text, "\t"); > (*info->fprintf_styled_func) > (info->stream, dis_style_immediate, "0x%016llx", > - (unsigned long long) data); > + (unsigned long) data); > break; > default: > abort (); LGTM, thanks. Jiawei