[PATCH 12/13] Recognize loongarch64 path in src/runtime

[email protected]
Newsgroups gmane.lisp.steel-bank.devel
Message-ID <[email protected]>
This patch updates src/runtime to correctly recognize LoongArch64 paths.

_______________________________________________
Sbcl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-devel
0012-recognize-loongarch64-path-in-src-runtime.patch (application/octet-stream, 2.9 KB)
From cd4ae90ddda0dd82c9d13c610eda846ef75629ed Mon Sep 17 00:00:00 2001
From: ZiLong Wang <[email protected]>
Date: Sat, 17 Jan 2026 10:32:55 +0800
Subject: [PATCH 12/13] recognize loongarch path in src/runtime

---
 src/runtime/code.h          | 2 +-
 src/runtime/globals.h       | 4 ++++
 src/runtime/pseudo-atomic.h | 3 ++-
 src/runtime/thread.c        | 2 +-
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/runtime/code.h b/src/runtime/code.h
index 760d3a5e4..27b0c7ce8 100644
--- a/src/runtime/code.h
+++ b/src/runtime/code.h
@@ -157,7 +157,7 @@ extern int simple_fun_index(struct code*, struct simple_fun*);
 // For those of us who are too memory-impaired to know how to use the value:
 //  - it is the amount to ADD to a tagged simple-fun pointer to get its entry address
 //  - or the amount to SUBTRACT from an entry address to get a tagged fun pointer
-#if defined(LISP_FEATURE_SPARC) || defined(LISP_FEATURE_ARM) || defined(LISP_FEATURE_RISCV)
+#if defined(LISP_FEATURE_SPARC) || defined(LISP_FEATURE_ARM) || defined(LISP_FEATURE_RISCV) || defined(LISP_FEATURE_LOONGARCH64)
 #define FUN_RAW_ADDR_OFFSET 0
 #else
 #define FUN_RAW_ADDR_OFFSET (offsetof(struct simple_fun, insts) - FUN_POINTER_LOWTAG)
diff --git a/src/runtime/globals.h b/src/runtime/globals.h
index 3b1fde3ec..eca5a8d78 100644
--- a/src/runtime/globals.h
+++ b/src/runtime/globals.h
@@ -159,6 +159,10 @@ extern void globals_init(void);
 #   define EXTERN(name) .globl name
 # endif
 
+# if defined(LISP_FEATURE_LOONGARCH64)
+#   define EXTERN(name) .globl name
+# endif
+
 #ifndef LISP_FEATURE_SB_THREAD
 EXTERN(foreign_function_call_active)
 #endif
diff --git a/src/runtime/pseudo-atomic.h b/src/runtime/pseudo-atomic.h
index 0832ebe33..ec3b450c4 100644
--- a/src/runtime/pseudo-atomic.h
+++ b/src/runtime/pseudo-atomic.h
@@ -39,7 +39,8 @@
 # define clear_pseudo_atomic_interrupted(th) (th)->pseudo_atomic_bits[2] = 0
 
 #elif defined LISP_FEATURE_ARM || defined LISP_FEATURE_ARM64 \
-  || defined LISP_FEATURE_MIPS || defined LISP_FEATURE_RISCV
+  || defined LISP_FEATURE_MIPS || defined LISP_FEATURE_RISCV \
+  || defined LISP_FEATURE_LOONGARCH64
 #include "thread.h" // for SymbolValue
 
 /* These architectures use a thread slot if #+sb-thread,
diff --git a/src/runtime/thread.c b/src/runtime/thread.c
index 360570ad1..e434cbc28 100644
--- a/src/runtime/thread.c
+++ b/src/runtime/thread.c
@@ -324,7 +324,7 @@ void create_main_lisp_thread(lispobj function) {
     ASSOCIATE_OS_THREAD(th);
     ASSIGN_CURRENT_THREAD(th);
 #if THREADS_USING_GCSIGNAL && \
-    (defined LISP_FEATURE_PPC || defined LISP_FEATURE_PPC64 || defined LISP_FEATURE_ARM64 || defined LISP_FEATURE_RISCV)
+    (defined LISP_FEATURE_PPC || defined LISP_FEATURE_PPC64 || defined LISP_FEATURE_ARM64 || defined LISP_FEATURE_RISCV) || defined(LISP_FEATURE_LOONGARCH64)
     /* SIG_STOP_FOR_GC defaults to blocked on PPC? */
     unblock_gc_stop_signal();
 #endif
-- 
2.20.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.