From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7138269680747151360 X-Received: by 2002:a05:6000:2aa:b0:225:63d0:83aa with SMTP id l10-20020a05600002aa00b0022563d083aamr13710587wry.499.1662007924901; Wed, 31 Aug 2022 21:52:04 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:4305:0:b0:3a3:2369:271d with SMTP id q5-20020a1c4305000000b003a32369271dls329826wma.0.-pod-preprod-gmail; Wed, 31 Aug 2022 21:52:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR5uOOrUUUtwUiJxm9E9XwkaYlR6HgVBtyloVAU+hRy3ZPu9KUqGxv4qZ8RfuJmEbZr1K9Vu X-Received: by 2002:a05:600c:4e04:b0:3a5:a34e:ae81 with SMTP id b4-20020a05600c4e0400b003a5a34eae81mr3722041wmq.147.1662007923379; Wed, 31 Aug 2022 21:52:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662007923; cv=none; d=google.com; s=arc-20160816; b=p2KRn2dcceyWSCof3MCS2MaSMVLEHW1cEXJtMc9ZkZc8EFw2u+rahGCySQMGoUunXY EUAeZPHCylbp3qGG2v8TmXeH4KxzoJ8ilTVidLcMJDQ7YnE2qmbsOO3HHo3zhy+m+IJK Zm+VqZuR0T1rym8wiAFpYBAYu9WbxjANlc9xtzZkb1aWEQO78pOg2L0HTWDBBDh2EPxt ROCLtdEQ0x+LlRTEHSFpZYamMzb5Ypa0NJkAuhOg+bbZUU9VYX8j4qegYiSVQ0BlbyIg Xzpm3D+9wknKjl++ZtXDt4+DgY43b5m7cCDBdIVO7RVrRaR1yqe312hXV7/tqw4aBLBP hEUg== 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=jxdC6KVDH8q9P2S85zbyMJ/Z4FpooE+XQnm/XsMRhmU=; b=T/+ytARU25YH4m5NeZc2p4NcruZKiaTdO9UWd15qd52CDB+FPA0Wy4c6eRrIGT60Np yM5uYnzBoiM4C1A6gCVtYEYo1ikdrczUcVUiuAlUQrDpRJGPMmzJzzLYm8e8zWW/lFT2 9iVFbj1EApBw+8hc35adK8CQ0H0hc1aYu6qwVcHb0RhCGd4dVIe7zlu7ZhVzA4l4sI4Q ylgreq1o3BZnagc9D+CDnGPUXtAzPrfasZE2EGJiwnV/RmDLPkBeDIuts+a1UmdH4yBs 8NN+um7jzuFPMAWk15EQwXz2fsRVGb7wZnmx2eNe3joYslXFPW5aRpugnP76unvLu+3x i4ZQ== 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 q18-20020a05600000d200b0022560048d34si725971wrx.3.2022.08.31.21.52.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Aug 2022 21:52:03 -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 2814q1Sb002055 (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 2/2] opensbi-sifive-fu540: Fix build with binutils 2.38 Date: Thu, 1 Sep 2022 06:52:01 +0200 Message-Id: <20220901045201.9294-3-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: fBBpe23I0JI9 Backport of https://github.com/riscv-software-src/opensbi/commit/5d53b55 from opensbi-1.1. Signed-off-by: Uladzimir Bely --- ...akefile-fix-build-with-binutils-2.38.patch | 58 +++++++++++++++++++ .../opensbi/opensbi-sifive-fu540_0.9.bb | 1 + 2 files changed, 59 insertions(+) create mode 100644 meta-isar/recipes-bsp/opensbi/files/0001-Makefile-fix-build-with-binutils-2.38.patch diff --git a/meta-isar/recipes-bsp/opensbi/files/0001-Makefile-fix-build-with-binutils-2.38.patch b/meta-isar/recipes-bsp/opensbi/files/0001-Makefile-fix-build-with-binutils-2.38.patch new file mode 100644 index 00000000..d52a4695 --- /dev/null +++ b/meta-isar/recipes-bsp/opensbi/files/0001-Makefile-fix-build-with-binutils-2.38.patch @@ -0,0 +1,58 @@ +From 5d53b55aa77ffeefd4012445dfa6ad3535e1ff2c Mon Sep 17 00:00:00 2001 +From: Aurelien Jarno +Date: Fri, 28 Jan 2022 18:33:46 +0100 +Subject: [PATCH] Makefile: 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 lib/sbi/sbi_tlb.o +<>/lib/sbi/sbi_tlb.c: Assembler messages: +<>/lib/sbi/sbi_tlb.c:190: Error: unrecognized opcode `fence.i' +make: *** [Makefile:431: <>/build/lib/sbi/sbi_tlb.o] Error 1 + +The fix is to specify those extensions explicitly in -march. However as +older binutils version do not support this, we first need to detect +that. + +Signed-off-by: Aurelien Jarno +Reviewed-by: Bin Meng +Tested-by: Alexandre Ghiti +Reviewed-by: Anup Patel +--- + Makefile | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index d6f097d..a294f46 100644 +--- a/Makefile ++++ b/Makefile +@@ -106,6 +106,9 @@ ifndef PLATFORM_RISCV_XLEN + endif + endif + ++# Check whether the assembler and the compiler support the Zicsr and Zifencei extensions ++CC_SUPPORT_ZICSR_ZIFENCEI := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) -nostdlib -march=rv$(OPENSBI_CC_XLEN)imafd_zicsr_zifencei -x c /dev/null -o /dev/null 2>&1 | grep "zicsr\|zifencei" > /dev/null && echo n || echo y) ++ + # Setup list of objects.mk files + ifdef PLATFORM + platform-object-mks=$(shell if [ -d $(platform_src_dir)/ ]; then find $(platform_src_dir) -iname "objects.mk" | sort -r; fi) +@@ -157,7 +160,11 @@ ifndef PLATFORM_RISCV_ABI + endif + ifndef PLATFORM_RISCV_ISA + ifneq ($(PLATFORM_RISCV_TOOLCHAIN_DEFAULT), 1) +- PLATFORM_RISCV_ISA = rv$(PLATFORM_RISCV_XLEN)imafdc ++ ifeq ($(CC_SUPPORT_ZICSR_ZIFENCEI), y) ++ PLATFORM_RISCV_ISA = rv$(PLATFORM_RISCV_XLEN)imafdc_zicsr_zifencei ++ else ++ PLATFORM_RISCV_ISA = rv$(PLATFORM_RISCV_XLEN)imafdc ++ endif + else + PLATFORM_RISCV_ISA = $(OPENSBI_CC_ISA) + endif +-- +2.35.1 + diff --git a/meta-isar/recipes-bsp/opensbi/opensbi-sifive-fu540_0.9.bb b/meta-isar/recipes-bsp/opensbi/opensbi-sifive-fu540_0.9.bb index c25215be..f114cec9 100644 --- a/meta-isar/recipes-bsp/opensbi/opensbi-sifive-fu540_0.9.bb +++ b/meta-isar/recipes-bsp/opensbi/opensbi-sifive-fu540_0.9.bb @@ -7,6 +7,7 @@ inherit dpkg SRC_URI = " \ https://github.com/riscv/opensbi/archive/v${PV}.tar.gz;downloadfilename=opensbi-${PV}.tar.gz \ + file://0001-Makefile-fix-build-with-binutils-2.38.patch \ file://sifive-fu540-rules" SRC_URI[sha256sum] = "60f995cb3cd03e3cf5e649194d3395d0fe67499fd960a36cf7058a4efde686f0" -- 2.20.1