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 78AC23830B10 for ; Tue, 15 Nov 2022 04:58:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 78AC23830B10 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id D017C300089; Tue, 15 Nov 2022 04:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1668488284; bh=ZzcX+wTveu/IJQGMxIZMCkFoi4iIbm0NQhyntGQmuKs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Mime-Version:Content-Transfer-Encoding; b=qF6z05/ZLYA26WPSjT2H+JXfRhK/YDOJO0eLWJjfMTmFLZl/etgDUaO07SUt4zebw x8kUoqzl0JstEBohSqLpLsCIXfAWk9UhJCO9d8uKUgrN6QN+SZCD57fFQeMxwHMcFg o6U26ib8focHmM56VhuwkNip2tPD4Ons4Zj8DLQM= From: Tsukasa OI To: Tsukasa OI , Nelson Chu , Kito Cheng , Palmer Dabbelt Cc: binutils@sourceware.org Subject: [PATCH 03/11] RISC-V: Make mapping symbol checking consistent Date: Tue, 15 Nov 2022 04:52:46 +0000 Message-Id: <6c6c644515c6bc2751062543097eb14ee98e97c8.1668487922.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.1 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 List-Id: There were two places where the mapping symbols are checked but had different conditions. - riscv_get_map_state: "$d" or starts with "$x" - riscv_elf_is_mapping_symbols: Starts with either "$x" or "$d" Considering recent mapping symbol proposal, it's better to make symbol checking consistent (whether the symbol _starts_ with "$[xd]"). It only checks prefix "$xrv" (mapping symbol with ISA string) only when the prefix "$x" is matched. opcodes/ChangeLog: * riscv-dis.c (riscv_get_map_state): Change the condition for consistency. --- opcodes/riscv-dis.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index ea45a631a25..d3bd4ceec1e 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -832,16 +832,17 @@ riscv_get_map_state (int n, return false; name = bfd_asymbol_name(info->symtab[n]); - if (strcmp (name, "$x") == 0) - *state = MAP_INSN; - else if (strcmp (name, "$d") == 0) - *state = MAP_DATA; - else if (strncmp (name, "$xrv", 4) == 0) + if (startswith (name, "$x")) { + if (startswith (name + 2, "rv")) + { + riscv_release_subset_list (&riscv_subsets); + riscv_parse_subset (&riscv_rps_dis, name + 2); + } *state = MAP_INSN; - riscv_release_subset_list (&riscv_subsets); - riscv_parse_subset (&riscv_rps_dis, name + 2); } + else if (startswith (name, "$d")) + *state = MAP_DATA; else return false; -- 2.37.2