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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 863FEC433EF for ; Thu, 23 Jun 2022 13:42:53 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 16BBB842E0; Thu, 23 Jun 2022 15:42:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=sntech.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id A7C0084343; Thu, 23 Jun 2022 15:42:49 +0200 (CEST) Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 25B1283FF6 for ; Thu, 23 Jun 2022 15:42:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=sntech.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heiko@sntech.de Received: from ip5b412258.dynamic.kabel-deutschland.de ([91.65.34.88] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1o4N6c-0001xe-7U; Thu, 23 Jun 2022 15:42:46 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: u-boot@lists.denx.de, Alexandre Ghiti , Heinrich Schuchardt Cc: Coelacanthus , Rick Chen , Leo Subject: Re: [PATCH] riscv: fix compitible with binutils 2.38 Date: Thu, 23 Jun 2022 15:42:45 +0200 Message-ID: <1826121.tdWV9SEqCh@diego> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi, Am Montag, 23. Mai 2022, 14:05:27 CEST schrieb Coelacanthus: > commit 6df2a016c0c8a3d0933ef33dd192ea6606b115e3 from linux kernel > > Since binutils 2.38, default ISA spec version switch to 20191213, > in this version, original I extension be split into I, Zicsr and Zifencei. > Zicsr is csr read/write (csrr*/csrw*) instructions, and Zifencei > is fence.i instruction. > This will cause compile error like this: > Error: unrecognized opcode `csrr a5,0xc01' > Error: unrecognized opcode `fence.i' > > This commit add code to detect new Zicsr and Zifencei extensions, > and enable it when needed. > > Signed-off-by: Coelacanthus > Cc: Rick Chen > Cc: Leo while this fixes the build issue I'm seeing after a recent binutils, there has been already a patch proposed for this fix [0] and in that thread some pending issue was discussed as well. So please coordinate with the other people over there :-) Thanks Heiko [0] https://lore.kernel.org/all/20220128134713.2322800-1-alexandre.ghiti@canonical.com/ > --- > arch/riscv/Makefile | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile > index 0b80eb8d86..62712f8d38 100644 > --- a/arch/riscv/Makefile > +++ b/arch/riscv/Makefile > @@ -24,7 +24,14 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y) > CMODEL = medany > endif > > -ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \ > +RISCV_MARCH_y = $(ARCH_BASE)$(ARCH_A)$(ARCH_C) > + > +# Newer binutils versions default to ISA spec version 20191213 which moves some > +# instructions from the I extension to the Zicsr and Zifencei extensions. > +toolchain-need-zicsr-zifencei := $(call cc-option-yn, -mabi=$(ABI) -march=$(RISCV_MARCH_y)_zicsr_zifencei) > +RISCV_MARCH_$(toolchain-need-zicsr-zifencei) := $(RISCV_MARCH_y)_zicsr_zifencei > + > +ARCH_FLAGS = -march=$(RISCV_MARCH_y) -mabi=$(ABI) \ > -mcmodel=$(CMODEL) > > PLATFORM_CPPFLAGS += $(ARCH_FLAGS) >