From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id EEC2E3852779 for ; Tue, 2 Aug 2022 05:54:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EEC2E3852779 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 3885730008A; Tue, 2 Aug 2022 05:54:56 +0000 (UTC) From: Tsukasa OI To: Tsukasa OI , "H . Peter Anvin" , Nelson Chu , Kito Cheng , Palmer Dabbelt Cc: binutils@sourceware.org Subject: [PATCH v2 3/4] RISC-V: Break early if RISCV_GP_SYMBOL is found Date: Tue, 2 Aug 2022 14:54:20 +0900 Message-Id: <41a85e6314f4d2e60058a8240a23b4fb53d057f2.1659419591.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP 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, 02 Aug 2022 05:54:59 -0000 If RISCV_GP_SYMBOL ("__global_pointer$") is found multiple times, it's definately something is going wrong *for the disassembler* (note: would not make the resulting ELF files invalid but at least confuses the disassembler) and the disassembler will not produce the consistent result. If so, it would be okay to just ignore second RISCV_GP_SYMBOL to make symbol lookup slightly faster. With this commit, the disassembler just breaks early when a RISCV_GP_SYMBOL is found. opcodes/ChangeLog: * riscv-dis.c (riscv_disassemble_insn): Break early if a RISCV_GP_SYMBOL is found. --- opcodes/riscv-dis.c | 1 + 1 file changed, 1 insertion(+) diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index 419c4746db9..3fd2b5a4ada 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -616,6 +616,7 @@ riscv_disassemble_insn (bfd_vma memaddr, insn_t word, disassemble_info *info) { pd->gp = bfd_asymbol_value (info->symtab[i]); pd->has_gp = true; + break; } } else -- 2.34.1