From patchwork Tue Nov 15 04:52:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsukasa OI X-Patchwork-Id: 20186 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2521184wru; Mon, 14 Nov 2022 20:58:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf5GAmGJojhEN3CJiyAxlfV3ez36qzGSSadLB1NWogD6pxLdKWJ5FS6C4bAPcDIlv/7M2+Th X-Received: by 2002:a05:6402:1247:b0:461:5542:6884 with SMTP id l7-20020a056402124700b0046155426884mr13069512edw.390.1668488314872; Mon, 14 Nov 2022 20:58:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668488314; cv=none; d=google.com; s=arc-20160816; b=ObgfnRZXKf8vclvdmYUfZ4uyF7PCT71fY0a+LjYbS7ZQ4CLQ0QX/nOQAWLnP6wCE1T dm5AdlyO6vJlSqkj4tms9Q5HCECfFmkd1nd7tNn+9z2YUjmZsK7QetoCd+NzgvYTxiKG PHv0afaBH5XNlvTsymUA5fMLJnHAM9Z42lcIO1Pk7q9oAqwM68nKI/xV6AZlWKoJ3mb6 eMAV8z5KFAh9jw0TVy2vVpoMLxgLnkE6klt/CvEDRuBggOjS1GA2UN+h4hftuodzs9cN Lrup0w8F/p8H4H++dX7wqkyiuxPTkOY8UzMTCZMfkRN9M8fziLpB+OreAQB45jLc22w9 Qd4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=ZzcX+wTveu/IJQGMxIZMCkFoi4iIbm0NQhyntGQmuKs=; b=JhPa80j7hV1bThrYNvuryu49me3hukCgtrYn6ych1uXwBliwG5jfhEHboc7/lSJ1UB oFVApRbUs9n+jEcBkBFJNQABuxQ40rDW5UgSiXZRn/sWT3g4/yenlUqUhinYVqWlRMoB 1DuaTPBGdR32sf8ALhqCR+oyWU6ikzsh2qfbS3IFaCruu6cjvbg7m1LVShe7qcE/ip43 /5G47BV3ZkloFkoT8k3bbqbR6u2Iizi7zzR46BhIVYhT8u8rhufrF2FGO2UN5hc5pPvG frv8Z9p7CMY68HUEnP0eSqfqTUpTsTrmbdMCdjwOA366jefn8RDC3kcS9y6/pFaMOjWZ /Bfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=n3egHilH; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id hp11-20020a1709073e0b00b0078d2a99972fsi11155960ejc.316.2022.11.14.20.58.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 20:58:34 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=n3egHilH; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 32345382EF1F for ; Tue, 15 Nov 2022 04:58:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 32345382EF1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668488295; bh=ZzcX+wTveu/IJQGMxIZMCkFoi4iIbm0NQhyntGQmuKs=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=n3egHilHN+LEAaiAu2SEgtdVte9cyTuGOSsc//+/JKng2iDn1M2bXcB7/YEa5AG27 7Rjp/tsY+lPe6LgCAk7fKF1kwT6x1gDXbUEuf/KgYcl3jKM1zca6u0F33UVZAvc+Dt 24pJA9I8XfQZld8SmEwcMcoWWX52ZWiClLGIrcZs= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org 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 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) 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 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 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-Patchwork-Original-From: Tsukasa OI via Binutils From: Tsukasa OI Reply-To: Tsukasa OI Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749536802991755025?= X-GMAIL-MSGID: =?utf-8?q?1749536802991755025?= 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;