Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2058966rwb; Thu, 27 Jul 2023 01:04:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlEUX8MJw+lgzLmJJZQxDNRA/DGUgBlR7ZdgMb3CgskAEabHYhB3HDyEdLRyy0rJwnQP51BY X-Received: by 2002:a05:6a00:1882:b0:686:bbfa:68e3 with SMTP id x2-20020a056a00188200b00686bbfa68e3mr6358447pfh.15.1690445073260; Thu, 27 Jul 2023 01:04:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690445073; cv=none; d=google.com; s=arc-20160816; b=DLLcXDYu7FBvbKr0seg4X8XwI1pDT/Ln0K2HzNYowri0vVhVJPD7kweF32esM1dleU 44K1OyHO58fjwZQa8wdzy/QzyJxYEFZjzD1j/KVcolobLxckpEIpS20o15fmsVD1DXTN 96B1D9P73Ys8S1W8nfRK5BB944N6bhvEk1mysXk5t6aXEGWrIc7E2UjnsJ3sjN1JRhWJ kXP6jWoqHNsf5FaxxfP1M+L1zIOSd7PUQVoAxS8GIn9b23suW2qqWUO4E1KAHVR73JKT D3/nihI+zU/hrVaTB03ya7ZYqcveu/THSJYHlVAFhsY5rZCE4pdTXuhbFLG4h/4omyWe 20Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=O/jRhfivh2zu3bricLNQt/BskuZiucgfZi4sEwXMFIE=; fh=zS+A7qZs79zdVjHVa2CWyX2E3FUP37EDSArE4iNS2Og=; b=dIWT2n+c6Z44JDCy4QXjCyPkn1yYZ2K3vbrDZ2wYwY96nqSJajnmXpHSgsLof6wOWy xBRcyyusVMOe1bPVH4b57drLIR8kWPkJgl/NUuggTcgqEodlVBi9Uy+ZlvXuqgYc3eNp 9Fb+k00jWvSBudd4OnO7mBPhQWw+mZw0J9MWWDM7vPffovCFKWj0EziVNIoZ6ibYQQUS GnYlGps9E7teV6TwDFxO6xxq9ux8EbcVbgyMoSL4xQag+CN2c7moecHmj3cj5h3uQBI+ 4SsYNOME2hSoh1JKN8Umvd4wmuwk6kalL+VIVat9O5fQuHiGlFVNNVSxGy1K6PgQvPJG zqeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m+ao2uFg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e8-20020a056a001a8800b0064d28b68d8fsi1054701pfv.94.2023.07.27.01.04.19; Thu, 27 Jul 2023 01:04:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m+ao2uFg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231927AbjG0H5I (ORCPT + 99 others); Thu, 27 Jul 2023 03:57:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232433AbjG0H4Z (ORCPT ); Thu, 27 Jul 2023 03:56:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 836AF9B; Thu, 27 Jul 2023 00:54:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1335A61D95; Thu, 27 Jul 2023 07:54:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1434EC433C7; Thu, 27 Jul 2023 07:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690444440; bh=N4vD5j/AWTskadRXxiH3iN9/rRLw1xJvEc+0YLJvx8U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m+ao2uFgcShr6jnD/bBgFiLj0mFMLOdwcj2dj1/w+jGR4Bu9NGX2MwMrGZ/zJ/3mq O86ypdhEOvfgOUl+2VGAt44TviqCUlHpLwDv5uMe8bVhdORFDDzB26HFN356gYnYxx 5rRIofqncHudt0bO6kSxlz8jsV+L9DtR4Bp/EMmaHNpk0jq9uYrACx+Sz9ilqqFr4k BasN2UO+iMZBhocwQq7HqwF4TB20ciGb7RjKqLcScb5Cswg3A5todAM20llwGaSaYJ 0g0Snm/d6lFMu5ukoubQtfRALvL/pLSLIrQXXyG9FByaZBmq5FpGEz6cqi5u4qlOve YBVMx4AvmE+kA== Date: Thu, 27 Jul 2023 08:53:55 +0100 From: Conor Dooley To: Mingzheng Xing Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Nathan Chancellor , Nick Desaulniers , Tom Rix , Bin Meng , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, stable@vger.kernel.org Subject: Re: [PATCH v2] riscv: Handle zicsr/zifencei issue between gcc and binutils Message-ID: <20230727-briskness-sappy-e2d9e4c1ef36@spud> References: <20230726174524.340952-1-xingmingzheng@iscas.ac.cn> <20230726-outclass-parade-2ccea9f6688a@spud> <10231b81-ea42-26d0-4c11-92851229e658@iscas.ac.cn> <20230726-armchair-evasive-427dd245a9fe@spud> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dEwon71W2kG8wE2d" Content-Disposition: inline In-Reply-To: <20230726-armchair-evasive-427dd245a9fe@spud> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --dEwon71W2kG8wE2d Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 26, 2023 at 08:41:55PM +0100, Conor Dooley wrote: > On Thu, Jul 27, 2023 at 03:34:16AM +0800, Mingzheng Xing wrote: > > On 7/27/23 02:02, Conor Dooley wrote: >=20 > > > This is still broken for: > > > CONFIG_CLANG_VERSION=3D0 > > > CONFIG_AS_IS_GNU=3Dy > > > CONFIG_AS_VERSION=3D23500 > > > CONFIG_LD_IS_BFD=3Dy > > > CONFIG_LD_VERSION=3D23500 > >=20 > > Do you mean that these CONFIG_* will cause kernel > > compilation errors when paired with certain versions of GCC? > > Or perhaps I misunderstood your meaning. >=20 > No, this section is generated by kconfig, although I messed up my > trimming of the list & accidentally removed the gcc version, rather > than the clang version. Here's the full thing: >=20 > CONFIG_CC_VERSION_TEXT=3D"riscv64-unknown-linux-gnu-gcc (g2ee5e430018) 12= =2E2.0" > CONFIG_CC_IS_GCC=3Dy > CONFIG_GCC_VERSION=3D120200 > CONFIG_CLANG_VERSION=3D0 > CONFIG_AS_IS_GNU=3Dy > CONFIG_AS_VERSION=3D23500 > CONFIG_LD_IS_BFD=3Dy > CONFIG_LD_VERSION=3D23500 > CONFIG_LLD_VERSION=3D0 > CONFIG_CC_CAN_LINK=3Dy > CONFIG_CC_CAN_LINK_STATIC=3Dy > CONFIG_CC_HAS_ASM_GOTO_OUTPUT=3Dy > CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT=3Dy > CONFIG_CC_HAS_ASM_INLINE=3Dy > CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=3Dy > CONFIG_PAHOLE_VERSION=3D0 > CONFIG_CONSTRUCTORS=3Dy > CONFIG_IRQ_WORK=3Dy > CONFIG_BUILDTIME_TABLE_SORT=3Dy I think this should sort things out for the even-older binutils case. I took the opportunity to fix some grammatical issues that seem to have snuck into the help text in your patch & to drop the \, since the depends on fits in one line. diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index e1b66ee88323..2d0d89213c97 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -571,25 +571,27 @@ config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI def_bool y # https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3Daed4428= 6efa8ae8717a77d94b51ac3614e2ca6dc # https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dcommit;h=3D98416dbb0a62579d4a7= a4a76bab51b5b52fec2cd - depends on GCC_VERSION >=3D 120100 || (AS_IS_GNU && AS_VERSION >=3D 23800) + depends on AS_IS_GNU + depends on (GCC_VERSION >=3D 120100 && AS_VERSION >=3D 23600) || AS_VERSI= ON >=3D 23800 help - Binutils-2.38 and GCC-12.1.0 bump default ISA spec to newer version + Binutils-2.38 and GCC-12.1.0 bump the default ISA spec to version 20191213 which moves some instructions from the I extension to the - Zicsr and Zifencei extensions. + Zicsr and Zifencei extensions. On the other hand, Binutils prior to + 2.35 does not understand these arguments and will error if they are + passed. =20 config TOOLCHAIN_NEEDS_OLD_ISA_SPEC def_bool y depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI # https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d449= 8694e15bf8a16 # https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dcommit;h=3Db03be74bad08c382da4= 7e048007a78fa3fb4ef49 - depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || \ - (CC_IS_GCC && GCC_VERSION < 110100) + depends on (CC_IS_CLANG && CLANG_VERSION < 170000) || (CC_IS_GCC && GCC_V= ERSION < 110100) help - Certain versions of clang (or GCC) do not support zicsr and zifencei via + Certain versions of clang and GCC do not support zicsr and zifencei via -march but newer versions of binutils require it for the reasons noted in the help text of CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI. This option causes an older ISA spec compatible with these older versions - of clang (or GCC) to be passed to GAS, which has the same result as + of clang and GCC to be passed to GAS, which has the same result as passing zicsr and zifencei to -march. =20 config FPU --dEwon71W2kG8wE2d Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZMIikwAKCRB4tDGHoIJi 0mJTAQCcVmPmrdY2nAX7oDB6KjPT6SR3RrzjqiuOt7KYjgKgwgEAm67Q03vVDHxp 3ehmCH7U3lO1Yol4wFTLp9UNPt9cWw8= =byRz -----END PGP SIGNATURE----- --dEwon71W2kG8wE2d--