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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49814C0015E for ; Thu, 27 Jul 2023 07:56:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233567AbjG0H45 (ORCPT ); Thu, 27 Jul 2023 03:56:57 -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> Precedence: bulk List-ID: X-Mailing-List: stable@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--