From patchwork Wed Feb 22 09:43:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jin Ma X-Patchwork-Id: 60434 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp478432wrd; Wed, 22 Feb 2023 01:45:10 -0800 (PST) X-Google-Smtp-Source: AK7set+hkOrpXYd12fSrPgNex67oENnRFKJ3GTt6/FvBvLCr789RD8HciVHrXlhlusWRXBZA56Vs X-Received: by 2002:a17:906:dc8e:b0:8e5:c06b:90e9 with SMTP id cs14-20020a170906dc8e00b008e5c06b90e9mr2880684ejc.50.1677059109785; Wed, 22 Feb 2023 01:45:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677059109; cv=none; d=google.com; s=arc-20160816; b=mbiMgbOltk4T50B+IXNHtJI1NzfR7HrmmRQhqL1orDdO3dsW6XuPoOPRgv+VRLbI3d OaUoiP31vCmvmWT3ay5Uyk5aYxJkfOs73gkLI6dBlB3q051rWYVnyzV9xmY3PwlI6y5X 8DqA5unwRMlzkLsbgH9XM8L7kZ0JarlHTIN12fkAKENqDBjIiOflBCzqadOdiaHMuNq4 GZCb7HQuqCDNXFc/IYB+I61S4MYXlSexuFZfPZGn0QBzo4uN4n1IPFgIRWMxvT9kMsjf 7ruSKs/CppzdDwnJp9vz7+n5waVZQzbTghgvieNaUv1CeruqccMuoKNnZRbqe5QyT/jf VtUw== 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:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=N9562vaDia6mQfnG82en7XwLvjaSCwUAvTyqnvI5Mis=; b=drV3isPU2n4Ozcw+UVwn7p9FP+UAccvVMsSwo08R9NlyDrnGuRCJWUsApxZZQRs+9N 4xgdqHEGknHepg+nMmYG4yf7ybW+L9z0l19BHyQrzSLO+ITcS5noNoaxq5nGs0djpFXS ZT86PgryFJ1Ge7vpKXOr2lUR+PqWKyKjSmetKkFWvfmA4RYuOR73Um4+GvfxjqkaFiIp 7mE8gcUHe7bsXhV6MYeGovAXP6M1d/XVus9OPX4GKIfgogQNXE/BLQkHyZ3RTGy65gyb PUJd8bRr5dpwFJ641uruE0MKM84FC10zj3UZIavCffet5rmQnPDpYUn42qubBtU0ugbR T0Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=THGpKRNj; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id aa23-20020a170907355700b008d80f0b9713si6893586ejc.674.2023.02.22.01.45.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 01:45:09 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=THGpKRNj; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 93AD9385840F for ; Wed, 22 Feb 2023 09:45:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93AD9385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677059108; bh=N9562vaDia6mQfnG82en7XwLvjaSCwUAvTyqnvI5Mis=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=THGpKRNjxwU2X62v3BnFu/agN3G4szvwnvVG+c81Ol8QMiw5oyDU1kICrd8vMv1q0 rmRydqCTJKuZB9fp75VA4yfqtBIB8qd/uNZZXDDHRChOjibVdKTSG17z1QfBsQw/Wr ox5jD8pqzuZNB18QGb2mnvpXLmvq3LZSSPoMG3R8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by sourceware.org (Postfix) with ESMTPS id 7CA4D3858D33 for ; Wed, 22 Feb 2023 09:44:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7CA4D3858D33 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R811e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018045170; MF=jinma@linux.alibaba.com; NM=1; PH=DS; RN=5; SR=0; TI=SMTPD_---0VcGUNE9_1677059056; Received: from localhost.localdomain(mailfrom:jinma@linux.alibaba.com fp:SMTPD_---0VcGUNE9_1677059056) by smtp.aliyun-inc.com; Wed, 22 Feb 2023 17:44:18 +0800 To: gcc-patches@gcc.gnu.org Cc: kito.cheng@sifive.com, kito.cheng@gmail.com, palmer@dabbelt.com, Jin Ma Subject: [PATCH] RISC-V: When the TARGET_COMPUTE_MULTILIB hook is implemented, check the version of each extension. Date: Wed, 22 Feb 2023 17:43:51 +0800 Message-Id: <20230222094351.1075-1-jinma@linux.alibaba.com> X-Mailer: git-send-email 2.38.1.windows.1 MIME-Version: 1.0 X-Spam-Status: No, score=-21.0 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jin Ma via Gcc-patches From: Jin Ma Reply-To: Jin Ma Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758523932718290642?= X-GMAIL-MSGID: =?utf-8?q?1758523932718290642?= When there is an extension with different versions, the result of the TARGET_COMPUTE_MULTILIB hook is generally wrong, so the version needs to be considered. gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_subset_list::match_score): Match the version of each extension. --- gcc/common/config/riscv/riscv-common.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index ebc1ed7d7e4..0a15ff705d1 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -331,10 +331,9 @@ riscv_subset_list::match_score (riscv_subset_list *list) const /* list must be subset of current this list, otherwise it not safe to link. TODO: We might give different weight for each extension, but the rule could - be complicated. - TODO: We might consider the version of each extension. */ + be complicated. */ for (s = list->m_head; s != NULL; s = s->next) - if (this->lookup (s->name.c_str ()) != NULL) + if (this->lookup (s->name.c_str (), s->major_version, s->minor_version) != NULL) score++; else return 0;