Message ID | 1f10468a4c8e5c5ba8984d2afa92bdca7be7f871.1691385124.git.research_trasio@irq.a4lg.com |
---|---|
State | Accepted |
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1234275vqr; Sun, 6 Aug 2023 22:13:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG0ogasFhqKwXosApL2wZERBJA562JHrMx9hm9z6r3yJvA+SNlxd1zXdAQcjvOnxvxFFB0V X-Received: by 2002:aa7:d697:0:b0:523:18db:e3ab with SMTP id d23-20020aa7d697000000b0052318dbe3abmr6448718edr.39.1691385206841; Sun, 06 Aug 2023 22:13:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691385206; cv=none; d=google.com; s=arc-20160816; b=zCo580F1gAYa+7sDWtg9mXUf+nXSxVteN11bSrNDijQRIp58KqeCCAbF5eBbSEAbbM ZrkQN1XGuUICOdrpdZelT7G/kZH9YMzriRrd3Um1TOQt7eLvwRA9MXAC0BFLk5O0Clx4 t478TfH9bIvYS7aGWdhMLp3wxUI27Ay9vNODUFIJM8E79SY5Odse3R0RMWR8udAQo3I4 nqMvK3S19gyRfXs2InCSKav2WNnpBDbjxc8RRRcAER4NKb0945oxY+OD1qyUCxzOFVe/ qydqx1c45ZY/mMC2WOQMxFjOHRPWJCBvhqDtQi2RvAQ8rznOVC+HqEPWRy45dkOi/kyk hVQg== 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=7EElR2k+6U5DjEyi6iQAVPndRW1qGyiGEgEBI2XMpEY=; fh=oLBbkpKGrMjsAiDUocfN7mW0LEnMJsqDdFE8uCs7/vo=; b=gw3CE71U9LTTC9V0OsprDuu92D8+CQ3RqbGUu8kcLYVzt481V2GIV+k+3H/x8A5HbF apesWQ5VpLTg7rBMZc99SmugrjvENZdSoVwB6L7eQtafOBUl1zmnaDOEdJlvQJjuk3TX 4b/VC8r/MX4llHL/6m8/KcZF2WWDq5HJTiCWsQwONbdl0jDQ6wMLsImUObFUITLbf4Lg ZF9CGWLy/JhsbZesKRvzd6LZCvseApAhriNxR/0AsnY2u31WiYW/R9Zoia3P3rEiOAR3 cG3c2mhkIXWfaXTDyChcLpPPjgVeFkl5zVRW2AGjBWYn//E7TpCFS2rh/m//CmSu4Wpd /zaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=hQ1CeS+O; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id w1-20020a056402128100b0052239439e90si2398023edv.484.2023.08.06.22.13.26 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Aug 2023 22:13:26 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.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=@sourceware.org header.s=default header.b=hQ1CeS+O; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 85C6F3858C31 for <ouuuleilei@gmail.com>; Mon, 7 Aug 2023 05:13:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 85C6F3858C31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1691385205; bh=7EElR2k+6U5DjEyi6iQAVPndRW1qGyiGEgEBI2XMpEY=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=hQ1CeS+OP7/6b+VWIo52j3wm5mj1IG/wjzzJt+Lhb9bgbX0VCmCzmxih5DIqZiSKj 3uGHfIRi09Ueijgssah7XNiqDYacP0wZaHB9ezXRpOF0BWyWjfqFiAQQgHEwoNMqA9 mt4Ffj1gPQQ0L6mW8h7buwVAhnBcr2p4z2eyCsZI= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org 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 E1C3A3858D28 for <binutils@sourceware.org>; Mon, 7 Aug 2023 05:13:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E1C3A3858D28 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 852AD300089; Mon, 7 Aug 2023 05:13:14 +0000 (UTC) To: Tsukasa OI <research_trasio@irq.a4lg.com>, Palmer Dabbelt <palmer@dabbelt.com>, Andrew Waterman <andrew@sifive.com>, Jim Wilson <jim.wilson.gcc@gmail.com>, Nelson Chu <nelson@rivosinc.com>, Kito Cheng <kito.cheng@sifive.com> Cc: binutils@sourceware.org Subject: [PATCH] RISC-V: Support extension version number 0.0 Date: Mon, 7 Aug 2023 05:13:08 +0000 Message-ID: <1f10468a4c8e5c5ba8984d2afa92bdca7be7f871.1691385124.git.research_trasio@irq.a4lg.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, KAM_MANYTO, KAM_NUMSUBJECT, 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 <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> From: Tsukasa OI via Binutils <binutils@sourceware.org> Reply-To: Tsukasa OI <research_trasio@irq.a4lg.com> Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773545934619342025 X-GMAIL-MSGID: 1773545934619342025 |
Series |
RISC-V: Support extension version number 0.0
|
|
Checks
Context | Check | Description |
---|---|---|
snail/binutils-gdb-check | success | Github commit url |
Commit Message
Tsukasa OI
Aug. 7, 2023, 5:13 a.m. UTC
From: Tsukasa OI <research_trasio@irq.a4lg.com>
Before this commit, the ISA string with "xextname0p0" is handled as the
'Xextname' without version number information (not version 0.0 as specified
in the string).
This commit makes able to handle version 0.0 and enable handling placeholder
extensions (with *actual* version number) easily (without being handled as
an unknown version).
This behavior is consistent with other locations that use the
"find_any_version" variable.
bfd/ChangeLog:
* elfxx-riscv.c (riscv_parsing_subset_version): Check whether we
have actually found a version number.
---
bfd/elfxx-riscv.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
base-commit: ad233d0d74661e5206d093e826db1eb4120c5fef
Comments
On Mon, Aug 7, 2023 at 1:13 PM Tsukasa OI <research_trasio@irq.a4lg.com> wrote: > From: Tsukasa OI <research_trasio@irq.a4lg.com> > > Before this commit, the ISA string with "xextname0p0" is handled as the > 'Xextname' without version number information (not version 0.0 as specified > in the string). > This is an expected behavior. The 0p0 means 0.0, since we won't have any version 0.0, so it means users don't give any specific version for extension, and let the compiler/assembler decide (usually use the default setting). The xextname0p0 is illegal, since toolchain won't have any default versions for those x extensions, so users must give a meaningful one. Nelson > > This commit makes able to handle version 0.0 and enable handling > placeholder > extensions (with *actual* version number) easily (without being handled as > an unknown version). > > This behavior is consistent with other locations that use the > "find_any_version" variable. > > bfd/ChangeLog: > > * elfxx-riscv.c (riscv_parsing_subset_version): Check whether we > have actually found a version number. > --- > bfd/elfxx-riscv.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c > index ee4598729480..d1db2df2f271 100644 > --- a/bfd/elfxx-riscv.c > +++ b/bfd/elfxx-riscv.c > @@ -1725,6 +1725,7 @@ riscv_parsing_subset_version (const char *p, > int *minor_version) > { > bool major_p = true; > + bool find_any_version = false; > int version = 0; > char np; > > @@ -1745,7 +1746,10 @@ riscv_parsing_subset_version (const char *p, > version = 0; > } > else if (ISDIGIT (*p)) > - version = (version * 10) + (*p - '0'); > + { > + find_any_version = true; > + version = (version * 10) + (*p - '0'); > + } > else > break; > } > @@ -1756,7 +1760,7 @@ riscv_parsing_subset_version (const char *p, > *minor_version = version; > > /* We can not find any version in string. */ > - if (*major_version == 0 && *minor_version == 0) > + if (!find_any_version) > { > *major_version = RISCV_UNKNOWN_VERSION; > *minor_version = RISCV_UNKNOWN_VERSION; > > base-commit: ad233d0d74661e5206d093e826db1eb4120c5fef > -- > 2.41.0 > >
On 2023/08/07 16:05, Nelson Chu wrote: > > > On Mon, Aug 7, 2023 at 1:13 PM Tsukasa OI <research_trasio@irq.a4lg.com > <mailto:research_trasio@irq.a4lg.com>> wrote: > > From: Tsukasa OI <research_trasio@irq.a4lg.com > <mailto:research_trasio@irq.a4lg.com>> > > Before this commit, the ISA string with "xextname0p0" is handled as the > 'Xextname' without version number information (not version 0.0 as > specified > in the string). > > > This is an expected behavior. The 0p0 means 0.0, since we won't have > any version 0.0, so it means users don't give any specific version for > extension, and let the compiler/assembler decide (usually use the > default setting). The xextname0p0 is illegal, since toolchain won't > have any default versions for those x extensions, so users must give a > meaningful one. > > Nelson Understood. I was making multiple branches corresponding some draft extensions and some of them don't have version numbers (e.g. if the draft is managed in Google Docs, not on GitHub). I used 0.0 as the placeholder and since it's invalid, I will replace them to 0.1 (I know they are going to be 1.0 once ratified but I don't want to use it for drafts). Thanks, Tsukasa > > > > This commit makes able to handle version 0.0 and enable handling > placeholder > extensions (with *actual* version number) easily (without being > handled as > an unknown version). > > This behavior is consistent with other locations that use the > "find_any_version" variable. > > bfd/ChangeLog: > > * elfxx-riscv.c (riscv_parsing_subset_version): Check whether we > have actually found a version number. > --- > bfd/elfxx-riscv.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c > index ee4598729480..d1db2df2f271 100644 > --- a/bfd/elfxx-riscv.c > +++ b/bfd/elfxx-riscv.c > @@ -1725,6 +1725,7 @@ riscv_parsing_subset_version (const char *p, > int *minor_version) > { > bool major_p = true; > + bool find_any_version = false; > int version = 0; > char np; > > @@ -1745,7 +1746,10 @@ riscv_parsing_subset_version (const char *p, > version = 0; > } > else if (ISDIGIT (*p)) > - version = (version * 10) + (*p - '0'); > + { > + find_any_version = true; > + version = (version * 10) + (*p - '0'); > + } > else > break; > } > @@ -1756,7 +1760,7 @@ riscv_parsing_subset_version (const char *p, > *minor_version = version; > > /* We can not find any version in string. */ > - if (*major_version == 0 && *minor_version == 0) > + if (!find_any_version) > { > *major_version = RISCV_UNKNOWN_VERSION; > *minor_version = RISCV_UNKNOWN_VERSION; > > base-commit: ad233d0d74661e5206d093e826db1eb4120c5fef > -- > 2.41.0 >
diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index ee4598729480..d1db2df2f271 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1725,6 +1725,7 @@ riscv_parsing_subset_version (const char *p, int *minor_version) { bool major_p = true; + bool find_any_version = false; int version = 0; char np; @@ -1745,7 +1746,10 @@ riscv_parsing_subset_version (const char *p, version = 0; } else if (ISDIGIT (*p)) - version = (version * 10) + (*p - '0'); + { + find_any_version = true; + version = (version * 10) + (*p - '0'); + } else break; } @@ -1756,7 +1760,7 @@ riscv_parsing_subset_version (const char *p, *minor_version = version; /* We can not find any version in string. */ - if (*major_version == 0 && *minor_version == 0) + if (!find_any_version) { *major_version = RISCV_UNKNOWN_VERSION; *minor_version = RISCV_UNKNOWN_VERSION;