Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3002087pxb; Thu, 10 Feb 2022 10:00:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxt4sL1fvkGHvIpZGoO+xefEk+jOx9oseDZbcYlOWAwZulK2x32qyLoQR7Qz81Q7Fcb44/ X-Received: by 2002:a17:903:124e:: with SMTP id u14mr8543090plh.57.1644516020557; Thu, 10 Feb 2022 10:00:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644516020; cv=none; d=google.com; s=arc-20160816; b=C/Ua/feJ7lCCMLfNm3O0WgXAPs/VQQGTJfHQU425WNhHsrPmuCeqmByrKr1v1KBgaQ xHElhQr4vL8Lc4s9Pzsbwu9uzHsrAcXLrx+m7+kOLpYk/QYZpPqHI8JBgEXb7gX9Gng/ k9ntZgKIFOPZbVl6PhBlw4nYFH2M9WqoLEDuntSZ594dlNTvU2dZWz6qr1rCIR2dvuIg dfbnzSf4Yh+f9k2quvNy+6dTv6W2CcM2l9yEZtR3PukisYMAZ8YtHBXj7qjrWwLCKSbM laiSKaSRycftR2TrLbPBzgn/DeQPVwYO1OcfjpkhVEEUXzd0c/aCHL5yQzSi7+/VzXER pVZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=myBRZosts+JYJ5LwNGhf9v9p6lhlpsXAJiru0hFcO1Y=; b=dMZp8NmlU6KIr3d5YQy5hjOZWcPu9hh7vGHJHCyQNZoKB0wDBn3532EvVdoPVFtLA+ KnoEie0oY2Zrvn/Ww9rd6iA+zzgge288iSGPpsH/5Wmqnfx3YeJ3/EOnyyJTHkB8OVGj OWD4uQgrGm4E3jmt73cCKX2cQ+OQH8ki/xSCsEyNQMoZp71Mc8WEfgeYfRWrW3IzFw8p nlBvrwqPZo9d9NrraGOECnP13QPPQiePJd2JGoHz/7tWmFSxx8lg4WblV7FVLjPSh0Ld SCR5wt7iXgPOt7lc/c26c9u/xc2WeI7T7eYfP2EW4R8yDLoOQNTnYpmEYH0PvG+P0xZS byrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20210112.gappssmtp.com header.s=20210112 header.b=aAjlLmer; 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 t1si21160662pfj.309.2022.02.10.10.00.07; Thu, 10 Feb 2022 10:00:20 -0800 (PST) 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; dkim=pass header.i=@dabbelt-com.20210112.gappssmtp.com header.s=20210112 header.b=aAjlLmer; 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 S245247AbiBJRk1 (ORCPT + 99 others); Thu, 10 Feb 2022 12:40:27 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245240AbiBJRkX (ORCPT ); Thu, 10 Feb 2022 12:40:23 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 436B025ED for ; Thu, 10 Feb 2022 09:40:24 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id c8-20020a17090a674800b001b91184b732so6840832pjm.5 for ; Thu, 10 Feb 2022 09:40:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=myBRZosts+JYJ5LwNGhf9v9p6lhlpsXAJiru0hFcO1Y=; b=aAjlLmerWaHRMPPmnTh/eMVQdksaqsQCPlhAeUmrvIzXcASlboU4inkIhxwnKYimuX 0GK/6q/yCs/SCXeQKr4c7hI0xr8pT1gDiF1qkPN6HK85ueijua7rkyxNcWmxmbtGYkA+ XyJijfGX6awchUj1c/r4uFmj8MGuCbhp6wB+uCEp3dtc9bsPBl4JFWBOa1tMRs0P/a9z U9lvKPUmipoEAqvwv6YU3Ne/vdwUqpn13CQSKM0n7Wf+QK2z5UXLsoVb60FWIBqEdWiG JdqxpprYHd09U2Ql3L5jib441sfzNu0TC/uX+ZPBGXQWJPLCk4tTLMoEzalbHSFlihR6 nw7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=myBRZosts+JYJ5LwNGhf9v9p6lhlpsXAJiru0hFcO1Y=; b=T4x81tyqLS4Gb/68wKKm7yzXWgbjwjvsDxyOgI6OAXj1qZ6bUPbidboGauAuk1mBIz hqQkXmpQ093DdopPUwW0iih7am9JAHC3mA6NyArkMcM4IYgt0XeKJTR/wJ6tdllc+5pj RtsVjt7vRcDmbmN8XPSV3dqWTJwCdQkFG2BMLJ1xP1CSnJEApZcVkmLWqTOxz55HNGdL v5rChJX4u1k+vILTjGhgaTTy1qzr7Xcd+obkOAHBRLMIaG9+5QPP6AHRCYWCcG/hrTwQ f/AkWyar+thLkV25zylM3WkFhK94//RwS1uwTtpYoXqOTjA/3PXoXCev1sS6GNieJE65 RUfQ== X-Gm-Message-State: AOAM530EzzJ2qbmi7lZmJVV1SRcFH3xOqqjOtFDeydRHrCHXWt8+85Gr iZHo/TyDqdcQ1zSXyy8M22yz5UlqLzkhTg== X-Received: by 2002:a17:90b:1b46:: with SMTP id nv6mr3878148pjb.143.1644514823391; Thu, 10 Feb 2022 09:40:23 -0800 (PST) Received: from localhost ([12.3.194.138]) by smtp.gmail.com with ESMTPSA id g5sm23970235pfv.22.2022.02.10.09.40.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 09:40:22 -0800 (PST) Date: Thu, 10 Feb 2022 09:40:22 -0800 (PST) X-Google-Original-Date: Thu, 10 Feb 2022 09:39:36 PST (-0800) Subject: Re: [PATCH] riscv: fix build with binutils 2.38 In-Reply-To: <20220126171442.1338740-1-aurelien@aurel32.net> CC: linux-kernel@vger.kernel.org, aurelien@aurel32.net, stable@vger.kernel.org, Kito Cheng , Paul Walmsley , aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org (open list:RISC-V ARCHITECTURE) From: Palmer Dabbelt To: aurelien@aurel32.net Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Wed, 26 Jan 2022 09:14:42 PST (-0800), aurelien@aurel32.net 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) Thanks, this is on fixes. It's CC stable, but doesn't have a "Fixes" tag -- I did that on purpose as this isn't really fixing a bug in Linux so I'm not sure it's right to point at a particular patch, but I'm not sure how that will play with the stable tree.