openembedded-core.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
From: "Trevor Gamblin" <tgamblin@baylibre.com>
To: openembedded-core@lists.openembedded.org
Cc: mark.hatle@kernel.crashing.org
Subject: [OE-core][PATCH 1/2] opensbi: patch Makefile for zicsr, zifencei extension check
Date: Thu, 10 Sep 2026 11:08:42 -0400	[thread overview]
Message-ID: <20260910150843.1531415-1-tgamblin@baylibre.com> (raw)

Backport a patch from upstream to fix the way OpenSBI's Makefile checks
for zicsr and zifencei extension support. The use of grep incorrectly
matches against build paths generated by Yocto, so the patch directly
checks the exit status from the assignment instead.

[YOCTO #15897]

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
 ...rep-when-setting-CC_SUPPORT_ZICSR_ZI.patch | 33 +++++++++++++++++++
 meta/recipes-bsp/opensbi/opensbi_1.9.bb       |  5 ++-
 2 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-bsp/opensbi/files/0001-Makefile-don-t-grep-when-setting-CC_SUPPORT_ZICSR_ZI.patch

diff --git a/meta/recipes-bsp/opensbi/files/0001-Makefile-don-t-grep-when-setting-CC_SUPPORT_ZICSR_ZI.patch b/meta/recipes-bsp/opensbi/files/0001-Makefile-don-t-grep-when-setting-CC_SUPPORT_ZICSR_ZI.patch
new file mode 100644
index 0000000000..db93d69e7c
--- /dev/null
+++ b/meta/recipes-bsp/opensbi/files/0001-Makefile-don-t-grep-when-setting-CC_SUPPORT_ZICSR_ZI.patch
@@ -0,0 +1,33 @@
+From b4ea30a4e46fa6fe4293f86c601394052e5e2b43 Mon Sep 17 00:00:00 2001
+From: Trevor Gamblin <tgamblin@baylibre.com>
+Date: Wed, 9 Sep 2026 14:33:24 -0400
+Subject: [PATCH 1/3] Makefile: don't grep when setting
+ CC_SUPPORT_ZICSR_ZIFENCEI
+
+Upstream-Status: Submitted [https://lists.infradead.org/pipermail/opensbi/2026-September/010606.html]
+
+Check exit status from the compiler/linker check directly (similar to
+OPENSBI_LD_PIE), rather than using grep to search for a pattern. This
+avoids potential unrelated matches in the command.
+
+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index aebaa98c..07ac7e30 100644
+--- a/Makefile
++++ b/Makefile
+@@ -204,7 +204,7 @@ CC_SUPPORT_SAVE_RESTORE := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) -nostdlib
+ CC_SUPPORT_STRICT_ALIGN := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) -nostdlib -mstrict-align -x c /dev/null -o /dev/null 2>&1 | grep -e "-mstrict-align" -e "-mno-unaligned-access" >/dev/null && echo n || echo y)
+ 
+ # 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 -e "zicsr" -e "zifencei" > /dev/null && echo n || echo y)
++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 >/dev/null 2>&1 && echo y || echo n)
+ 
+ # Check whether the assembler and the compiler support the Vector extension
+ CC_SUPPORT_VECTOR := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) -nostdlib -march=rv$(OPENSBI_CC_XLEN)gv -dM -E -x c /dev/null 2>&1 | grep -q riscv.*vector && echo y || echo n)
+-- 
+2.55.0
+
diff --git a/meta/recipes-bsp/opensbi/opensbi_1.9.bb b/meta/recipes-bsp/opensbi/opensbi_1.9.bb
index 0142ef6787..954753d97e 100644
--- a/meta/recipes-bsp/opensbi/opensbi_1.9.bb
+++ b/meta/recipes-bsp/opensbi/opensbi_1.9.bb
@@ -9,7 +9,10 @@ require opensbi-payloads.inc
 inherit deploy
 
 SRCREV = "cbf9f6734dd85a982c63e3cb5db7ffe09da839ca"
-SRC_URI = "git://github.com/riscv/opensbi.git;branch=master;protocol=https;tag=v${PV}"
+SRC_URI = " \
+            git://github.com/riscv/opensbi.git;branch=master;protocol=https;tag=v${PV} \
+            file://0001-Makefile-don-t-grep-when-setting-CC_SUPPORT_ZICSR_ZI.patch \
+            "
 
 TARGET_DBGSRC_DIR = "/share/opensbi/*/generic/firmware/"
 
-- 
2.55.0



             reply	other threads:[~2026-09-10 15:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 15:08 Trevor Gamblin [this message]
2026-09-10 15:08 ` [OE-core][PATCH 2/2] arch-riscv.inc: allow zicsr, zifencei in TUNE_RISCV_PKGARCH Trevor Gamblin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260910150843.1531415-1-tgamblin@baylibre.com \
    --to=tgamblin@baylibre.com \
    --cc=mark.hatle@kernel.crashing.org \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).