aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-11-16 15:57:51 +0000
committerGitHub <noreply@github.com>2023-11-16 15:57:51 +0000
commit2310380df54fada9da5becff0b5f36f540d60fc4 (patch)
treef094d0ff6103ad9643ce90b01e2b6ec32300e898
parent34843a26f8e5dd5626e2702371fdbf98c6d1827f (diff)
parent0880967e05cc8d3c4b9e52073f8fb453c13ae22c (diff)
downloadrspamd-2310380df54fada9da5becff0b5f36f540d60fc4.tar.gz
rspamd-2310380df54fada9da5becff0b5f36f540d60fc4.zip
Merge pull request #4704 from wuruilong01/master
Add support for loongarch
-rw-r--r--cmake/FindArch.cmake2
-rw-r--r--contrib/backward-cpp/backward.hpp2
-rw-r--r--contrib/libev/ev.c2
-rw-r--r--src/rspamd.c2
4 files changed, 8 insertions, 0 deletions
diff --git a/cmake/FindArch.cmake b/cmake/FindArch.cmake
index d1defc82b..e17220737 100644
--- a/cmake/FindArch.cmake
+++ b/cmake/FindArch.cmake
@@ -35,6 +35,8 @@ set(archdetect_c_code "
#else
#error cmake_ARCH ppc
#endif
+#elif defined(__loongarch__) || defined(__loongarch64)
+ #error cmake_ARCH loongarch64
#endif
#error cmake_ARCH unknown
diff --git a/contrib/backward-cpp/backward.hpp b/contrib/backward-cpp/backward.hpp
index ce725559b..ca09b7217 100644
--- a/contrib/backward-cpp/backward.hpp
+++ b/contrib/backward-cpp/backward.hpp
@@ -4222,6 +4222,8 @@ public:
#else
error_addr = reinterpret_cast<void *>(uctx->uc_mcontext.pc);
#endif
+#elif defined(__loongarch__)
+ error_addr = reinterpret_cast<void *>(uctx->uc_mcontext.__pc);
#elif defined(__mips__)
error_addr = reinterpret_cast<void *>(
reinterpret_cast<struct sigcontext *>(&uctx->uc_mcontext)->sc_pc);
diff --git a/contrib/libev/ev.c b/contrib/libev/ev.c
index 8657aa96e..230445d2a 100644
--- a/contrib/libev/ev.c
+++ b/contrib/libev/ev.c
@@ -843,6 +843,8 @@ struct signalfd_siginfo
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("tb1 0,%%r0,128" : : : "memory")
#elif defined __sh__
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("" : : : "memory")
+ #elif defined __loongarch__ || __loongarch64
+ #define ECB_MEMORY_FENCE __asm__ __volatile__ ("dbar %0 ": : "I"(0) : "memory")
#endif
#endif
#endif
diff --git a/src/rspamd.c b/src/rspamd.c
index df08f5410..b8523b44b 100644
--- a/src/rspamd.c
+++ b/src/rspamd.c
@@ -1279,6 +1279,8 @@ get_cpu_architecture(void)
return "ARM64";
#elif defined(__arm__) || defined(_M_ARM)
return "ARM";
+#elif defined(__loongarch__) || defined(__loongarch64)
+ return "LOONGARCH64";
#elif defined(__mips__)
return "MIPS";
#elif defined(__powerpc__) || defined(_M_PPC)