Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2356289pxb; Sun, 30 Jan 2022 13:25:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDL8MuMaI2olngUxk+ZYghWt7623L8IFm4LhEUDfqXKQpXmKlyGP7SvA+0sj35nYZNHO4m X-Received: by 2002:a62:2745:: with SMTP id n66mr17521506pfn.15.1643577951942; Sun, 30 Jan 2022 13:25:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643577951; cv=none; d=google.com; s=arc-20160816; b=h51gXT42V9trrhOg5X+eWy3Ru6Q8CVaJig7xL32NlvAU+6T0Zxu1fDl1B4nP49n+/l cks+hU54nFgwP5S7rYJas4LC9FbpoKk7R3Yztek9ADM5LZFkHqZkWpqhSV15eVQWyllq ZNhfS7OB60I2/nNRqmbrF3+Zx525hEpyFj2D0XOoOLUDEaflDieUz0bn7AptrF7cYeCi nCCd6fBSfTqnI/zS6cDXgrmHUYYUVFXLZN6vTSMo1OKjMgSsdf88lNz44QILU/Rshy+o 51JaTEqeb9JmrNONwxc6jcnGzgRBIgw69jPMQSmrXZApPlCv0NaaHado0aQDtSuEtAj0 JJFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=O2AwCzmYc8oJyRvt38Q3eFdAEi62fT7JJ41T7HDRaZY=; b=DsgCVVinuF85JbniGxQTTpVS7tFPnxKySBB/d70zXTl97Ce7kGlYFNc34Z37uMcwyA P6NxFOa4MazS4X1BNWAhp4p/drerLLrBRi3L/s9ko10wQN8rOJu7P+ymEntEcQRcsaXT lp6GqyJmTzoTyhNvqnks5kTXpmAXLvJzk5nbv06OTNb+U363OBFFsT06/UOzN4H3oNDY wwyX7kJ/etayhlh3gC1AeYoJT6JD8ZFBZPCspi9cF5VUKy+tC7xWviK8Q69K257JoLFl e+MaZARQPrlnPYpSYUR4mZmS287x1tkT/3MtoA6NSWKusWsxGlczDTvOlm9Rn63QBwJj ZRsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=jFynAPC5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y38si12519082pfa.204.2022.01.30.13.25.41; Sun, 30 Jan 2022 13:25:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=jFynAPC5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241367AbiA1KFl (ORCPT + 99 others); Fri, 28 Jan 2022 05:05:41 -0500 Received: from smtp-relay-internal-0.canonical.com ([185.125.188.122]:41254 "EHLO smtp-relay-internal-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234425AbiA1KFj (ORCPT ); Fri, 28 Jan 2022 05:05:39 -0500 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 552163F4B6 for ; Fri, 28 Jan 2022 10:05:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1643364338; bh=O2AwCzmYc8oJyRvt38Q3eFdAEi62fT7JJ41T7HDRaZY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=jFynAPC5jS3TuSW0DwBFoBtJMNpyruFX8Ud/SKY65dHlfFes688+9yvc2QTtU+4bn L+fKJrSxitVSAHYJS0Lb+lLPdLNGVSkUQWVAO8AmIXdD9/0T9pXt/nlKX2Dg5JZLvg H8BjAwM5L0VoO7mDKvh7sbWtnRYDMn8tRNFmfzuHyGPOIvRAxcWk6hRGxyfrBa42ly M84OT647Chcd/U3H8T1CzYex/OEjWSKoUMR3kpTmI5/1/LWKK2Sw02hIIZBPuKNear bgOKMy5GSRw6czM5B5u2tVYp4mrImUzZjAYDfSiGZ7rxJNJU0a8OjkiHgfe9iZz7uy cgbx9VXJCrjeg== Received: by mail-ed1-f70.google.com with SMTP id i22-20020a50fd16000000b00405039f2c59so2833089eds.1 for ; Fri, 28 Jan 2022 02:05:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=O2AwCzmYc8oJyRvt38Q3eFdAEi62fT7JJ41T7HDRaZY=; b=phIPaxSPJH7lUL/JhW7WTY4dAGIiQf3ANsLCAOv0yn4Invs1RK9whm9aY0Hzg8AMJK DSUqsLLkbFv6DjNJZmrG/xz0DVk7h5RtemcG6UW2mQcj2dDdKArCpFw6zwxgKB4rth2r c50ygNqkmJj3QgsM7IC7Xtvi73bU4n02jsSdmwSgaxthYyU0wJ81Z47ahGJy7UU43XPr qg/zKO8kwXzkIGr2+3j+9dHT24kWbtCNWxUymCE+qG4xoVbwHVDF577mPY5nF5bBnkZH cHXaQDEqHkRs6ljyh2oxXcdqHpfR4dTaHv0xRT7Ih/MPx92dQEhLtXg5lhG4cxJqgP98 7DVA== X-Gm-Message-State: AOAM533Ny63GE2R31sP16uSeEBjdJNmodTeTf6mJ0gZpvZkqSvVh9C+G OzmxeWjVMdT753T7kKVl7tLrzLj+OOsmNRkitvOHMtbNQWTaSFjMfuc7Hv6irrXp0XZONodiW6u +IJnvCqPeeAL22451Eue/IQAFU5NAQGRf8IFSwM+mN5Y16x+L9t88eJldng== X-Received: by 2002:a05:6402:424a:: with SMTP id g10mr7509432edb.309.1643364337933; Fri, 28 Jan 2022 02:05:37 -0800 (PST) X-Received: by 2002:a05:6402:424a:: with SMTP id g10mr7509413edb.309.1643364337738; Fri, 28 Jan 2022 02:05:37 -0800 (PST) MIME-Version: 1.0 References: <20220126171442.1338740-1-aurelien@aurel32.net> In-Reply-To: <20220126171442.1338740-1-aurelien@aurel32.net> From: Alexandre Ghiti Date: Fri, 28 Jan 2022 11:05:26 +0100 Message-ID: Subject: Re: [PATCH] riscv: fix build with binutils 2.38 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" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Aurelien, On Wed, Jan 26, 2022 at 6:41 PM 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: > > CC arch/riscv/kernel/vdso/vgettimeofday.o > <>/arch/riscv/include/asm/vdso/gettimeofday.h: Assembler messages: > <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01' > <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01' > <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01' > <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01' > > 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. > > Cc: stable@vger.kernel.org # 4.15+ > Cc: Kito Cheng > Signed-off-by: Aurelien Jarno > --- > arch/riscv/Makefile | 6 ++++++ > 1 file changed, 6 insertions(+) > > 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) := rv32ima > riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima > riscv-march-$(CONFIG_FPU) := $(riscv-march-y)fd > riscv-march-$(CONFIG_RISCV_ISA_C) := $(riscv-march-y)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, -march=$(riscv-march-y)_zicsr_zifencei) > +riscv-march-$(toolchain-need-zicsr-zifencei) := $(riscv-march-y)_zicsr_zifencei > + > KBUILD_CFLAGS += -march=$(subst fd,,$(riscv-march-y)) > KBUILD_AFLAGS += -march=$(riscv-march-y) > > -- > 2.34.1 > > That fixes our kernel build with the new binutils, so you can add: Tested-by: Alexandre Ghiti Thanks for working on this! Alex > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv