Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp309723pxb; Thu, 31 Mar 2022 06:06:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0t1z9K+yeYCLsVT3FQ5H6hAOzZb5VXaMiWVTxSadeKaVHu7aiITSDZyv6iB8GDb90/eHx X-Received: by 2002:a17:907:1ca3:b0:6e0:eb09:8 with SMTP id nb35-20020a1709071ca300b006e0eb090008mr4882434ejc.49.1648731972917; Thu, 31 Mar 2022 06:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648731972; cv=none; d=google.com; s=arc-20160816; b=znNgW65Elaj8nC9p/IS9G5qTG+aPPFfoaGFiSCMRZzEjjrUi9/PvVipPfmSvbu1nnr lM7M4oV2PNWnVSmsFUEc/J88sRqAosBStUxZc4vGuIzBKvrmfoCdQtiXcoKcrF9knbUT Pch9C97WPlQcYPSNtfsmwnfJqH+dKqLNAtixd0TOdk9Xovf/tXHZk6Zj3kgiALiuS4oC Q1FMwsOncGSR7kPt5w/aERJkT6/HFsUfBzNSGBhAPXvZpTPZ/a0ircI0lRFe37HHqUqw szH3j7V4nVvqA6fowbqbQBqsREdmbAbH2uLs6LFO9edWwAj9lCgXvgOj76+HfzF5uXUB II+A== 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; bh=A4a33paVzALn1dG71hEc1imxDfnuSWDocJz3eiHuFTI=; b=bH/PQ9G6mo0TbBTLLkim1Ni10PH/n/BLtR2sSyNHVC6oUdZ2XE6UI7pLI8zgYqyqK5 XYhqCY0y23Y4FdlKAmW91CWeYmRZ4g3URGlrh4KkEIWgHGCFO6vRnAlQNUwpVcgQYAYL 4yp1Tf7v7V7i8V6R79ycQPjT/GP0IRgCOIDaYBuZzFes7dkF4JsJY512J/DdcARevoyb xyuTEGKEAy+DdTx2BOgjEZJvudS7RPFIP43AK4u/iI2IE6I/lhxsheA6Pp6/EAXrPskX 0Y3lDtUJjp2Zv1WLpzrxp9w7IKJzddiS02YBrvAsi6BtHv10hjt6Y3rbvAGYjn9US/Ar GwUg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v18-20020a50d092000000b00418c2b5bf7csi24225551edd.606.2022.03.31.06.05.47; Thu, 31 Mar 2022 06:06:12 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233655AbiCaKev (ORCPT + 99 others); Thu, 31 Mar 2022 06:34:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232547AbiCaKeu (ORCPT ); Thu, 31 Mar 2022 06:34:50 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72CF0204282 for ; Thu, 31 Mar 2022 03:33:02 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=bjornoya.blackshift.org) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZs6k-000591-1J; Thu, 31 Mar 2022 12:32:50 +0200 Received: from pengutronix.de (2a03-f580-87bc-d400-ffcf-bd2e-518f-8dbf.ip6.dokom21.de [IPv6:2a03:f580:87bc:d400:ffcf:bd2e:518f:8dbf]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mkl-all@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id A858C57B54; Thu, 31 Mar 2022 10:32:47 +0000 (UTC) Date: Thu, 31 Mar 2022 12:32:47 +0200 From: Marc Kleine-Budde To: Aurelien Jarno Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Kito Cheng , Paul Walmsley , Palmer Dabbelt , Albert Ou , "open list:RISC-V ARCHITECTURE" Subject: Re: [PATCH] riscv: fix build with binutils 2.38 Message-ID: <20220331103247.y33wvkxk5vfbqohf@pengutronix.de> References: <20220126171442.1338740-1-aurelien@aurel32.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="vglrjwx3za2fhczz" Content-Disposition: inline In-Reply-To: <20220126171442.1338740-1-aurelien@aurel32.net> X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,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 --vglrjwx3za2fhczz Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 26.01.2022 18:14:42, Aurelien Jarno wrote: > From version 2.38, binutils default to ISA spec version 20191213. This > means that the csr read/write (csrr*/csrw*) instructions and fence.i > instruction has separated from the `I` extension, become two standalone > extensions: Zicsr and Zifencei. As the kernel uses those instruction, > this causes the following build failure: >=20 > CC arch/riscv/kernel/vdso/vgettimeofday.o > <>/arch/riscv/include/asm/vdso/gettimeofday.h: Assembler mess= ages: > <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unre= cognized opcode `csrr a5,0xc01' > <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unre= cognized opcode `csrr a5,0xc01' > <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unre= cognized opcode `csrr a5,0xc01' > <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unre= cognized opcode `csrr a5,0xc01' >=20 > The fix is to specify those extensions explicitely in -march. However as > older binutils version do not support this, we first need to detect > that. >=20 > Cc: stable@vger.kernel.org # 4.15+ > Cc: Kito Cheng > Signed-off-by: Aurelien Jarno > --- > arch/riscv/Makefile | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile > index 8a107ed18b0d..7d81102cffd4 100644 > --- a/arch/riscv/Makefile > +++ b/arch/riscv/Makefile > @@ -50,6 +50,12 @@ riscv-march-$(CONFIG_ARCH_RV32I) :=3D rv32ima > riscv-march-$(CONFIG_ARCH_RV64I) :=3D rv64ima > riscv-march-$(CONFIG_FPU) :=3D $(riscv-march-y)fd > riscv-march-$(CONFIG_RISCV_ISA_C) :=3D $(riscv-march-y)c > + > +# Newer binutils versions default to ISA spec version 20191213 which mov= es some > +# instructions from the I extension to the Zicsr and Zifencei extensions. > +toolchain-need-zicsr-zifencei :=3D $(call cc-option-yn, -march=3D$(riscv= -march-y)_zicsr_zifencei) > +riscv-march-$(toolchain-need-zicsr-zifencei) :=3D $(riscv-march-y)_zicsr= _zifencei > + > KBUILD_CFLAGS +=3D -march=3D$(subst fd,,$(riscv-march-y)) > KBUILD_AFLAGS +=3D -march=3D$(riscv-march-y) I'm on current linus/master, this change breaks on current Debian testing with: | make: Leaving directory 'linux' | SYNC include/config/auto.conf.cmd | GEN Makefile | GEN Makefile | CC scripts/mod/empty.o | CHECK linux/scripts/mod/empty.c | invalid argument to '-march': '_zicsr_zifencei' Used components: | $ riscv64-linux-gnu-gcc -v | Using built-in specs. | COLLECT_GCC=3D/usr/bin/riscv64-linux-gnu-gcc | COLLECT_LTO_WRAPPER=3D/usr/lib/gcc-cross/riscv64-linux-gnu/11/lto-wrapper | Target: riscv64-linux-gnu | Configured with: ../src/configure -v --with-pkgversion=3D'Debian 11.2.0-9= ' --with-bugurl=3Dfile:///usr/share/doc/gcc-11/README.Bugs --enable-languag= es=3Dc,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=3D/usr --with-gcc-majo= r-version-only --program-suffix=3D-11 --enable-shared --enable-linker-build= -id --libexecdir=3D/usr/lib --without-included-gettext --enable-threads=3Dp= osix --libdir=3D/usr/lib --enable-nls --with-sysroot=3D/ --enable-clocale= =3Dgnu --enable-libstdcxx-debug --enable-libstdcxx-time=3Dyes --with-defaul= t-libstdcxx-abi=3Dnew --enable-gnu-unique-object --disable-libitm --disable= -libquadmath --disable-libquadmath-support --enable-plugin --enable-default= -pie --with-system-zlib --enable-libphobos-checking=3Drelease --without-tar= get-system-zlib --enable-multiarch --disable-werror --disable-multilib --wi= th-arch=3Drv64imafdc --with-abi=3Dlp64d --enable-checking=3Drelease --build= =3Dx86_64-linux-gnu --host=3Dx86_64-linux-gnu --target=3Driscv64-linux-gnu = --program-prefix=3Driscv64-linux-gnu- --includedir=3D/usr/riscv64-linux-gnu= /include --with-build-config=3Dbootstrap-lto-lean --enable-link-serializati= on=3D2 | Thread model: posix | Supported LTO compression algorithms: zlib zstd | gcc version 11.2.0 (Debian 11.2.0-9)=20 | $ riscv64-linux-gnu-ld -v | GNU ld (GNU Binutils for Debian) 2.38 regards, Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --vglrjwx3za2fhczz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEBsvAIBsPu6mG7thcrX5LkNig010FAmJFg0wACgkQrX5LkNig 010Pvgf/ZoWGG7K/5FYXrD6DqvRxaZGgXBUeIVFePKiNNRXC82F6VNIytbqSEg09 9LcT0qzh51lGHAI9n+ur77Hmiit//P0M3GYLxigpabDMtBoYN5iWwZpobYMP42ox DCZ4ECYfzj/Hhtm++McTEGMW+EMCaKOf+53R3hS6Z7vmgfltDoT/Y6bmTNs9Vjue bvxT9UN8iVhNiPgSwmA4VVaNAHoTyzYS+Axck6ndKq2qWLh6Rbu45MYaNMtWgz7l Qfptz5E9TOaGItBnV47952dz2U6tsIvqNZBXdsqgQ501oeZMfk3jTvP+agrekeal GDu+6B+/oPYD13DvqdchERnZaYNJLw== =Jfvd -----END PGP SIGNATURE----- --vglrjwx3za2fhczz--