summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenedikt Freisen <b.freisen@gmx.net>2025-11-14 21:38:37 +0100
committerAnup Patel <anup@brainfault.org>2025-12-15 18:42:00 +0530
commit6a20872c91c65ae45df5c68c9717442153d0dace (patch)
tree4d83333f2209a758107fa9f436ab435c8ef32ae9
parentd65c1e95a737d8365a6b170c2074c27b56fc5bcb (diff)
downloadopensbi-6a20872c91c65ae45df5c68c9717442153d0dace.tar.gz
opensbi-6a20872c91c65ae45df5c68c9717442153d0dace.zip
Makefile: sensible default value for OPENSBI_CC_XLEN.
If guessing the compiler's XLEN fails, use 64 rather than garbage. The previous behavior could silently break e.g. OPENSBI_CC_SUPPORT_VECTOR when cross-compiling with a system's native clang. Signed-off-by: Benedikt Freisen <b.freisen@gmx.net> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20251114203842.13396-3-b.freisen@gmx.net Signed-off-by: Anup Patel <anup@brainfault.org>
-rw-r--r--Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index eb95164c..46541063 100644
--- a/Makefile
+++ b/Makefile
@@ -151,6 +151,12 @@ endif
# Guess the compiler's XLEN
OPENSBI_CC_XLEN := $(shell TMP=`$(CC) $(CLANG_TARGET) -dumpmachine | sed 's/riscv\([0-9][0-9]\).*/\1/'`; echo $${TMP})
+# If guessing XLEN fails, default to 64
+ifneq ($(OPENSBI_CC_XLEN),32)
+ ifneq ($(OPENSBI_CC_XLEN),64)
+ OPENSBI_CC_XLEN = 64
+ endif
+endif
# Guess the compiler's ABI and ISA
ifneq ($(CC_IS_CLANG),y)