From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C6EFAC001DC for ; Thu, 27 Jul 2023 07:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6Usb4DoI7DVdOLFWSBlCVogEymDW0xqIfMDMl4mG0HU=; b=Nz0MU9TaS1NUz13YoV1WRleNQc cqckWtNE4L3oMsVN3CBwgQR4V8fBSAnO6v55v+8AK/oZgggKoSa+8UB4SeC8XuzAh/E3dA7jZNyzC C5/kgKPlNy3lroI4xB+4vXNaq5AyiD7M7L2tqufCVXnpN6Ih/VaLNruNcwAatrtrm03jFPaItD9bj p4mOiMt3dHcGlojqveOjJf9rRypzJh3iiiq/Xn+4NEpq/GtrGaHhtpiP5y94STC/0A1MtsL6rUAcO hwtdldATeKrtmfHipuhd6vfjLroqxrwjxc0BKATLua4LhL/ajSLFpnmbomI+wol8N1uMxvkZQdzn+ 55V4oSVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qOvoy-00CVII-1F; Thu, 27 Jul 2023 07:54:04 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qOvov-00CVHr-1q for linux-riscv@lists.infradead.org; Thu, 27 Jul 2023 07:54:03 +0000 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 11B9061D46; 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 In-Reply-To: <20230726-armchair-evasive-427dd245a9fe@spud> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230727_005401_715619_8D6BB8D9 X-CRM114-Status: GOOD ( 21.72 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============8416989941031863942==" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org --===============8416989941031863942== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dEwon71W2kG8wE2d" Content-Disposition: inline --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-- --===============8416989941031863942== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv --===============8416989941031863942==--