From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id F1B48385AC1D for ; Tue, 9 Aug 2022 03:40:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F1B48385AC1D Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 50EDE30008A; Tue, 9 Aug 2022 03:40:38 +0000 (UTC) From: Tsukasa OI To: Tsukasa OI , "H . Peter Anvin" , Nelson Chu , Kito Cheng , Palmer Dabbelt Cc: binutils@sourceware.org Subject: [PATCH v3 3/4] RISC-V: Fix JALR target address computation Date: Tue, 9 Aug 2022 12:39:53 +0900 Message-Id: <5eb2f4ae02aab7d320dfa0335e30b4e03cb6554d.1660016372.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2022 03:40:41 -0000 Palmer Dabbelt discovered that we have wrong address computation for JALR instruction (the initial bug is back in 2018). This commit will fix that. opcodes/ChangeLog: * riscv-dis.c (print_insn_args): Fix JALR address computation. --- opcodes/riscv-dis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index 419c4746db9..162a2971320 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -406,7 +406,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info case 'b': case 's': if ((l & MASK_JALR) == MATCH_JALR) - maybe_print_address (pd, rs1, 0, false); + maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), false); print (info->stream, dis_style_register, "%s", riscv_gpr_names[rs1]); break; -- 2.34.1