Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6015107pxb; Mon, 14 Feb 2022 13:10:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1i1UyfTgxshHaAlMAko2oe08Ncohxon5HRtvGDjVoEx76K5I/7ESGD07Ig+wZGjMcPDcy X-Received: by 2002:a17:902:da81:: with SMTP id j1mr751318plx.3.1644873043035; Mon, 14 Feb 2022 13:10:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644873043; cv=none; d=google.com; s=arc-20160816; b=y23DSjmiwRdemvMRG9B9ljynxwY1uAXxhDCWtOu/tZVc3LRbM+6pVpY8sWuuPskXOW HivodoSjT+574BPerKnP1YpGmJolS9TKWt7AyOZOrxj7QrzMn2t5Zr+kDuw5w/U/Vr79 gI21Wt4t/7LTkUfzhy1TWL5SWl7pdgSUv/7k36Q4OtVIsejIOWtRDAJqq3rihgTh+rZn e6MkSUdi6O5+B98LKhvF3M3S5EV6TfrEh8VoCJ1PsalheXRXjo/OPg6IVwKtw7bG+Og4 mY5rfwVwfEkrArZzd/ssGHp6ti8A9zADG6KSidS5sFGHoRXlOcLTKxgue1gS75WMtyyT oH7Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DcwZaCdORPjrRdbGWAioh5ZNRHyvlytydGX/JW72Rlk=; b=IY4s5PSxDdsoOMyDMxDLuHS6c81Kobfcp69Gjsgctt1WMw6RySnaNXB3Su0tR+45rU FMtL47a+de1JQNwwZUlaATCljc9AqCfFQ5S7q0QnzqZMBcxxYm/132EIIhd1RzQfWPqh oX8U9rc6mOxcNt5twpReRJjbfF5PCMhtC6KN58SF2lVbCKGe6IWJ5g9jSUL/U+gj0rv7 aLqASkEDLd6yzc96LpTse/umCTRd5CKRJNT3JqROPk1f+ntGk8RJ5yGiyYIkbQ6y1i8l WhJYA+g7Lq+du/wxFLS/ALoMjYOMcFfpWTYbYFXGIsBsGgaKiTWCISoNZxK2vfnV3Wsb Gzjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dGua5wDH; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x188si691467pgb.570.2022.02.14.13.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 13:10:43 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dGua5wDH; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C8DAF1959FF; Mon, 14 Feb 2022 12:30:47 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343737AbiBNJyY (ORCPT + 99 others); Mon, 14 Feb 2022 04:54:24 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343732AbiBNJvQ (ORCPT ); Mon, 14 Feb 2022 04:51:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E317766224; Mon, 14 Feb 2022 01:42:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A26FFB80DC1; Mon, 14 Feb 2022 09:41:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C166BC340E9; Mon, 14 Feb 2022 09:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644831718; bh=UhSIihMSSu2vmuCQjZPE4NANjKqrX8Al7bFfWHKoSt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dGua5wDHB11zN+s4i2opOUrIF9SLV77lTiRbUdWEfLmH+dVhNEWcMJKyR2LIyGfJE 9iiK6dvsaU9dGc1054PumQucAY7sg9ZZmsa4jGzVd6G7f+LNyFWGSzMSa82/cCxmru a+11yTu5utPRP1GvFKo8NmvCXh8lPxgJQFSOOtL0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aurelien Jarno , Alexandre Ghiti , Palmer Dabbelt Subject: [PATCH 5.10 042/116] riscv: fix build with binutils 2.38 Date: Mon, 14 Feb 2022 10:25:41 +0100 Message-Id: <20220214092500.141729768@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092458.668376521@linuxfoundation.org> References: <20220214092458.668376521@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Aurelien Jarno commit 6df2a016c0c8a3d0933ef33dd192ea6606b115e3 upstream. >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. Signed-off-by: Aurelien Jarno Tested-by: Alexandre Ghiti Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -50,6 +50,12 @@ riscv-march-$(CONFIG_ARCH_RV32I) := rv32 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)