Hi!

The attached patch sets the machine type identifier on RISC-V properly.
Thanks to "Irvine" for providing this information.


felix
From fd536eff59c9ce78a9150d09392e56c508044d30 Mon Sep 17 00:00:00 2001
From: felix <fe...@call-with-current-continuation.org>
Date: Sun, 11 Apr 2021 17:11:04 +0200
Subject: [PATCH] detect RISC-V platform and set machine identifier

---
 chicken.h      | 6 ++++++
 config-arch.sh | 1 +
 2 files changed, 7 insertions(+)
 mode change 100644 => 100755 config-arch.sh

diff --git a/chicken.h b/chicken.h
index b35e1a07..0b9c2613 100644
--- a/chicken.h
+++ b/chicken.h
@@ -664,6 +664,12 @@ void *alloca ();
 # define C_MACHINE_TYPE "ia64"
 #elif defined(__x86_64__)
 # define C_MACHINE_TYPE "x86-64"
+#elif defined(__riscv)
+# if defined(__LP64__) || defined(_LP64)
+#  define C_MACHINE_TYPE "riscv64"
+# else
+#  define C_MACHINE_TYPE "riscv"
+# endif
 #elif defined(__arm64__) || defined(__aarch64__)
 # define C_MACHINE_TYPE "arm64"
 #elif defined(__arm__)
diff --git a/config-arch.sh b/config-arch.sh
old mode 100644
new mode 100755
index 52609acb..414b6d87
--- a/config-arch.sh
+++ b/config-arch.sh
@@ -34,5 +34,6 @@ case "`uname -m`" in
            *) echo "ppc.sysv";;
        esac;;
     amd64|x86_64) echo "x86-64";;
+    riscv*) echo "riscv";;
     *) ;;
 esac
-- 
2.24.2

Reply via email to