Source: gauche
Version: 0.9.10-3
Severity: wishlist
Tags: ftbfs
User: debian-loonga...@lists.debian.org
Usertags: loong64

Dear maintainers,

Compiling the gauche failed for loong64 in the Debian Package Auto-Building environment. The error message is as follows,
```
In file included from ./include/private/gc_priv.h:123,
                 from ./include/private/dbg_mlc.h:28,
                 from extra/../backgraph.c:15,
                 from extra/gc.c:40:
./include/private/gcconfig.h:709:5: error: #error The collector has not been ported to this machine/OS combination   709 | #   error The collector has not been ported to this machine/OS combination
      |     ^~~~~
./include/private/gcconfig.h:3068:3: error: #error Undefined ALIGNMENT
 3068 | # error Undefined ALIGNMENT
      |   ^~~~~
......
```
The full build log can be found at https://buildd.debian.org/status/logs.php?pkg=gauche&ver=0.9.10-3&arch=loong64

I have added the loongarch64 support in gauche source code.
The gauche source package was compiled successfully on my local environment and the test cases passed.
```
make[2]: Entering directory “/home/buildd/gauche-0.9.10/src”
Testing math.* modules ... passed.
Testing data.* modules ... passed.
Testing util.* modules extra ... passed.
Testing optimizer ... passed.
Testing control ... passed.
Testing miscellaneous compiler features ... passed.
Testing debug features ... passed.
Testing utility scripts ... passed.
Testing interactive ... passed.
Testing r7rs-tests ... passed.
Testing r7rs-aux ... passed.
make[2]: Leaving directory “/home/buildd/gauche-0.9.10/src”
Total: 30709 tests, 30709 passed,     0 failed,     0 aborted.
```
Please consider the patch I have attached.
If you have any questions, you can contact me at any time.

thanks,
Dandan Zhang

Description: Add loongarch64 support 
Last-Update: 2023-10-28

--- gauche-0.9.10.orig/gc/include/private/gcconfig.h
+++ gauche-0.9.10/gc/include/private/gcconfig.h
@@ -675,6 +675,11 @@ EXTERN_C_BEGIN
 #   define mach_type_known
 # endif
 
+# if defined(__loongarch__) && defined(LINUX)
+#    define LOONGARCH
+#    define mach_type_known
+# endif
+
 # if defined(SN_TARGET_PSP2)
 #   define mach_type_known
 # endif
@@ -1742,6 +1747,21 @@ EXTERN_C_BEGIN
 #   define STACKBOTTOM ((ptr_t)0xfffff000) /* for Encore */
 # endif
 
+# ifdef LOONGARCH
+#   define MACH_TYPE "LoongArch"
+#   define CPP_WORDSZ __loongarch_grlen
+#   define ALIGNMENT (__loongarch_grlen/8)
+#   ifdef LINUX
+#     define OS_TYPE "LINUX"
+#     pragma weak __data_start
+      extern int __data_start[];
+#     define DATASTART ((ptr_t)(__data_start))
+#     define LINUX_STACKBOTTOM
+#     define COUNT_UNMAPPED_REGIONS
+#     define DYNAMIC_LOADING
+#   endif
+# endif /* LOONGARCH */
+
 # ifdef MIPS
 #   define MACH_TYPE "MIPS"
 #   ifdef LINUX

Reply via email to