From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7138269680747151360 X-Received: by 2002:a17:907:7f9e:b0:73c:6f39:7399 with SMTP id qk30-20020a1709077f9e00b0073c6f397399mr22394925ejc.358.1662007924422; Wed, 31 Aug 2022 21:52:04 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6402:40d2:b0:43d:b3c4:cd21 with SMTP id z18-20020a05640240d200b0043db3c4cd21ls1225730edb.2.-pod-prod-gmail; Wed, 31 Aug 2022 21:52:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR7pPh4QjDaSnJFsVV58veOKu66Tk0L3RkZA6BLWUs4KA8iwtk5IU+eHH8s5OMhV+PxdI1CR X-Received: by 2002:aa7:cb06:0:b0:446:7668:2969 with SMTP id s6-20020aa7cb06000000b0044676682969mr27086636edt.206.1662007922886; Wed, 31 Aug 2022 21:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662007922; cv=none; d=google.com; s=arc-20160816; b=TuncSj49w6gQ6XmZ9Q0LDiBPICcfbMT8cRHbbkMSqFK+mmtpk4xiDTjdf483ZdNEfm RJ43Kk8AeUgXBOAiW70YBYAUpyyTitKlVJMyPv+iU4PXKNfRRCmgmL/r+LtVVNV2gKMs 6q0eCbv4Cw9LrftI5/qMWRTmiofXPUovRGxqFFbsCHBE8pJ/1Sl56uRHoc1YaAq+jMhH uu9HyuWn8E4eTWKzsOhbyfq3MXYNM7lqeekhLR9ep2aSNsy4G+jbfFUw9gCMFzOoFui0 4nXve2mYzpWxwyxU/ey0oGhYV8CPv6w17sODw/PKGGmOHhdEQrn5udABT7J0VszCLDAk 12qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from; bh=WHn7ROyPTUEz44ivtaB696gMkRWhq3aMB92UgX43+OU=; b=NehhBGaGSMuxi2sQJkigDKxjKAq1EVZq70s+IkhbDGccW84FmwwVnUhpHAr4e7cAXj 3CFMsdD4TpG1tz/T+EvBh45ppIbQhabe5eQTWQxY1haM3s1mLXLVPK1fyAfdwXMUJhHd JnhYD4kjXGqU+EhWn6vQwDrcvpE58jPYumaFqCh7mJa+HDyfO/5tyfcC7sYwMmKWaf3q UcqpDK0PE40MyUiQ61jKO91G5KpBc6B2KYVZS63IT7tbMaA/elvBQK3TXuc9Sw6Mrphj t48VmckpexH9ttEDTagm1qO2698FzQSP/n3KQFp1iaxkVecBT01Mi8wCsGSfGyLMWunP qD8Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id s20-20020aa7d794000000b0043cd530210bsi78313edq.5.2022.08.31.21.52.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Aug 2022 21:52:02 -0700 (PDT) Received-SPF: pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Received: from baighyz.m.ilbers.de (host-80-81-17-52.static.customer.m-online.net [80.81.17.52]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 2814q1Sa002055 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 1 Sep 2022 06:52:02 +0200 From: Uladzimir Bely To: isar-users@googlegroups.com Subject: [PATCH 1/2] linux-mainline: Fix riscv64 build with binutils 2.38 Date: Thu, 1 Sep 2022 06:52:00 +0200 Message-Id: <20220901045201.9294-2-ubely@ilbers.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220901045201.9294-1-ubely@ilbers.de> References: <20220901045201.9294-1-ubely@ilbers.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-TUID: yKH1V4KcT0+n Backport of https://github.com/torvalds/linux/commit/6df2a016c0c8 from linux-5.17. Signed-off-by: Uladzimir Bely --- ...1-riscv-fix-build-with-binutils-2.38.patch | 50 +++++++++++++++++++ .../linux/linux-mainline_5.4.70.bb | 2 + 2 files changed, 52 insertions(+) create mode 100644 meta-isar/recipes-kernel/linux/files/0001-riscv-fix-build-with-binutils-2.38.patch diff --git a/meta-isar/recipes-kernel/linux/files/0001-riscv-fix-build-with-binutils-2.38.patch b/meta-isar/recipes-kernel/linux/files/0001-riscv-fix-build-with-binutils-2.38.patch new file mode 100644 index 00000000..d0920e54 --- /dev/null +++ b/meta-isar/recipes-kernel/linux/files/0001-riscv-fix-build-with-binutils-2.38.patch @@ -0,0 +1,50 @@ +From 6df2a016c0c8a3d0933ef33dd192ea6606b115e3 Mon Sep 17 00:00:00 2001 +From: Aurelien Jarno +Date: Wed, 26 Jan 2022 18:14:42 +0100 +Subject: [PATCH] riscv: fix build with binutils 2.38 + +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 +--- + 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.35.1 + diff --git a/meta-isar/recipes-kernel/linux/linux-mainline_5.4.70.bb b/meta-isar/recipes-kernel/linux/linux-mainline_5.4.70.bb index 644535e8..b1ae6e60 100644 --- a/meta-isar/recipes-kernel/linux/linux-mainline_5.4.70.bb +++ b/meta-isar/recipes-kernel/linux/linux-mainline_5.4.70.bb @@ -15,6 +15,8 @@ SRC_URI += " \ file://no-ubifs-fs.cfg \ file://no-root-nfs.cfg;apply=no" +SRC_URI_append_riscv64 = " file://0001-riscv-fix-build-with-binutils-2.38.patch" + SRC_URI[sha256sum] = "c0b3d8085c5ba235df38b00b740e053659709e8a5ca21957a239f6bc22c45007" S = "${WORKDIR}/linux-${ARCHIVE_VERSION}" -- 2.20.1