Bug#1061414: clisp: please add support for loong64
Source: clisp
Severity: normal
X-Debbugs-Cc: wuruilong@loongson.cn
Dear Maintainer,
Please refer to the attachment patch to support loong64 arch
wuruilong
-- System Information:
Debian Release: trixie/sid
APT prefers unreleased
APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: loong64 (loongarch64)
Kernel: Linux 5.10.0-60.96.0.126.oe2203.loongarch64 (SMP w/32 CPU threads)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect
Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
clisp (1:2.49.20210628.gitde01f0f-3.1) unstable; urgency=medium
.
* Non-maintainer upload.
* Drop clisp-module-pcre. (Closes: #1000089)
Author: Bastian Germann <bage@debian.org>
Bug-Debian: https://bugs.debian.org/1000089
---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>
Last-Update: 2024-01-24
--- clisp-2.49.20210628.gitde01f0f.orig/src/lispbibl.d
+++ clisp-2.49.20210628.gitde01f0f/src/lispbibl.d
@@ -259,6 +259,9 @@
#if defined(__riscv) && (__riscv_xlen == 64)
#define RISCV64
#endif
+ #if defined(__loongarch__) || defined(__loongarch64)
+ #define LOONGARCH64
+ #endif
/* 64-bit processors: */
#ifdef __alpha
#define DECALPHA
@@ -591,7 +594,7 @@
#define log2_C_CODE_ALIGNMENT 1
#define C_FUNCTION_POINTER_BIAS 2
#endif
-#if defined(M68K) || defined(RISCV64) || defined(__CR16__) || defined(__cris__) || defined(__H8300__) || defined(__mcore__) || defined(__mep__) || defined(__moxie__) || defined(__MSP430__) || defined(__pdp11__) || defined(__sh__) || defined(__xstormy16__) || defined(__v850__) || defined(__vax__)
+#if defined(M68K) || defined(RISCV64) || defined(__CR16__) || defined(__cris__) || defined(__H8300__) || defined(__mcore__) || defined(__mep__) || defined(__moxie__) || defined(__MSP430__) || defined(__pdp11__) || defined(__sh__) || defined(__xstormy16__) || defined(__v850__) || defined(__vax__) || defined(LOONGARCH64)
#define C_CODE_ALIGNMENT 2
#define log2_C_CODE_ALIGNMENT 1
#endif
@@ -2777,6 +2780,10 @@ typedef enum {
#define MAPPABLE_ADDRESS_RANGE_START 0x000080000000UL
#define MAPPABLE_ADDRESS_RANGE_END 0x001FFFFFFFFFUL
#endif
+ #if defined(UNIX_LINUX) && defined(LOONGARCH64)
+ #define MAPPABLE_ADDRESS_RANGE_START 0x000080000000UL
+ #define MAPPABLE_ADDRESS_RANGE_END 0x001FFFFFFFFFUL
+ #endif
#if defined(UNIX_LINUX) && defined(S390_64)
/* On Linux/s390x:
MMAP_FIXED_ADDRESS_HIGHEST_BIT = 52
@@ -4340,6 +4347,10 @@ Long-Float, Ratio and Complex (only if S
#define HEAPCODES1BIT_WITH_TRIVIALMAP_WORKS 1
#define HEAPCODES1BIT_WITH_MALLOC_WORKS 1
#endif
+ #if defined(UNIX_LINUX) && defined(LOONGARCH64)
+ #define HEAPCODES1BIT_WITH_TRIVIALMAP_WORKS 1
+ #define HEAPCODES1BIT_WITH_MALLOC_WORKS 1
+ #endif
#if defined(UNIX_LINUX) && defined(S390_64) /* Linux/s390x */
#define HEAPCODES1BIT_WITH_TRIVIALMAP_WORKS 1 /* but only with(!) GENERATIONAL_GC */
#define HEAPCODES1BIT_WITH_MALLOC_WORKS 0
@@ -4729,6 +4740,9 @@ Long-Float, Ratio and Complex (only if S
#if defined(UNIX_LINUX) && defined(RISCV64) /* Linux/riscv64 */
#define GENERIC64C_HEAPCODES_WORKS 1
#endif
+ #if defined(UNIX_LINUX) && defined(LOONGARCH64)
+ #define GENERIC64C_HEAPCODES_WORKS 1
+ #endif
#if defined(UNIX_LINUX) && defined(S390_64) /* Linux/s390x */
#define GENERIC64C_HEAPCODES_WORKS 1
#endif
@@ -5031,6 +5045,9 @@ Long-Float, Ratio and Complex (only if S
#if defined(UNIX_LINUX) && defined(RISCV64) /* Linux/riscv64 */
#define TYPECODES_WITH_TRIVIALMAP_WORKS 1
#endif
+ #if defined(UNIX_LINUX) && defined(LOONGARCH64)
+ #define TYPECODES_WITH_TRIVIALMAP_WORKS 1
+ #endif
#if defined(UNIX_LINUX) && defined(S390_64) /* Linux/s390x */
#define TYPECODES_WITH_TRIVIALMAP_WORKS 1
#endif
@@ -5167,6 +5184,9 @@ Long-Float, Ratio and Complex (only if S
#if defined(UNIX_LINUX) && defined(RISCV64) /* Linux/riscv64 */
#define TYPECODES_WITH_MALLOC_WORKS 1
#endif
+ #if defined(UNIX_LINUX) && defined(LOONGARCH64)
+ #define TYPECODES_WITH_MALLOC_WORKS 1
+ #endif
#if defined(UNIX_LINUX) && defined(S390_64) /* Linux/s390x */
#define TYPECODES_WITH_MALLOC_WORKS 1
#endif
@@ -5396,6 +5416,8 @@ typedef signed_int_with_n_bits(intVsize)
!(defined(UNIX_LINUX) && (defined(MIPS) || defined(MIPS64))) \
&& /* It does not work on Linux/riscv64 so far (Linux bug with PROT_NONE). */\
!(defined(UNIX_LINUX) && defined(RISCV64)) \
+ && \
+ !((defined(UNIX_LINUX) && defined(LOONGARCH64))
&& /* It does not work on NetBSD 7 (both NetBSD/i386 and NetBSD/sparc). */\
!defined(UNIX_NETBSD) \
&& /* It does not work in QEMU user-mode. */ \
@@ -6227,7 +6249,7 @@ typedef signed_int_with_n_bits(intVsize)
#if defined(I80386) || defined(POWERPC) || defined(ARM) || defined(S390)
#define varobject_alignment 4
#endif
-#if defined(SPARC) || defined(HPPA) || defined(MIPS) || defined(DECALPHA) || defined(IA64) || defined(AMD64) || defined(ARM64) || defined(RISCV64)
+#if defined(SPARC) || defined(HPPA) || defined(MIPS) || defined(DECALPHA) || defined(IA64) || defined(AMD64) || defined(ARM64) || defined(RISCV64) || defined(LOONGARCH64)
#define varobject_alignment 8
#endif
#if (!defined(TYPECODES) || defined(GENERATIONAL_GC)) && (varobject_alignment < 4)
@@ -11838,6 +11860,9 @@ All other long words on the LISP-Stack a
#ifdef RISCV64
#define SP_register "sp"
#endif
+ #ifdef LOONGARCH64
+ #define SP_register "$sp"
+ #endif
#endif
#if (defined(GNU) || defined(INTEL)) && !defined(NO_ASM)
/* Assembler-instruction that copies the SP-register into a variable. */
@@ -11888,6 +11913,9 @@ All other long words on the LISP-Stack a
#ifdef RISCV64
#define ASM_get_SP_register(resultvar) ("mv %0,sp" : "=r" (resultvar) : )
#endif
+ #ifdef LOONGARCH64
+ #define ASM_get_SP_register(resultvar) ("mv %0,$sp" : "=r" (resultvar) : )
+ #endif
#endif
#if defined(GNU) && defined(M68K) && !defined(NO_ASM)
/* Access to a global register-"variable" SP */
Reply to: