Bug#1089673: Add support for loong64
Source: nim
Version: 1.6.14-3
Followup-For: Bug #1089673
X-Debbugs-Cc: debian-loongarch@lists.debian.org
Dear Maintainer,
The upstream has indeed supported the loongarch architecture, the PR link is as follows: https://github.com/nim-lang/Nim/pull/19223. The patch generated according to the upstream has been added to the attachment.
wuruilong
--- nim-1.6.14.orig/compiler/platform.nim
+++ nim-1.6.14/compiler/platform.nim
@@ -231,6 +231,7 @@ const
(name: "avr", intSize: 16, endian: littleEndian, floatSize: 32, bit: 16),
(name: "msp430", intSize: 16, endian: littleEndian, floatSize: 32, bit: 16),
(name: "sparc64", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64),
+ (name: "loongarch64", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64)],
(name: "mips64", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64),
(name: "mips64el", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64),
(name: "riscv32", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),
--- nim-1.6.14.orig/lib/system.nim
+++ nim-1.6.14/lib/system.nim
@@ -1126,7 +1126,7 @@ const
## Possible values:
## `"i386"`, `"alpha"`, `"powerpc"`, `"powerpc64"`, `"powerpc64el"`,
## `"sparc"`, `"amd64"`, `"mips"`, `"mipsel"`, `"arm"`, `"arm64"`,
- ## `"mips64"`, `"mips64el"`, `"riscv32"`, `"riscv64"`.
+ ## `"mips64"`, `"mips64el"`, `"riscv32"`, `"riscv64"`, `"loongarch64"`.
seqShallowFlag = low(int)
strlitFlag = 1 shl (sizeof(int)*8 - 2) # later versions of the codegen \
--- nim-1.6.14.orig/lib/system/platforms.nim
+++ nim-1.6.14/lib/system/platforms.nim
@@ -35,7 +35,8 @@ type
msp430, ## TI MSP430 microcontroller
riscv32, ## RISC-V 32-bit processor
riscv64, ## RISC-V 64-bit processor
- wasm32 ## WASM, 32-bit
+ wasm32, ## WASM, 32-bit
+ loongarch64 ## LoongArch 64-bit processor
OsPlatform* {.pure.} = enum ## the OS this program will run on.
none, dos, windows, os2, linux, morphos, skyos, solaris,
@@ -93,5 +94,6 @@ const
elif defined(riscv32): CpuPlatform.riscv32
elif defined(riscv64): CpuPlatform.riscv64
elif defined(wasm32): CpuPlatform.wasm32
+ elif defined(loongarch64): CpuPlatform.loongarch64
else: CpuPlatform.none
## the CPU this program will run on.
--- nim-1.6.14.orig/tools/nim.zsh-completion
+++ nim-1.6.14/tools/nim.zsh-completion
@@ -94,6 +94,7 @@ _nim() {
'*--cpu=sparc64[compile for SPARC64 architecture]' \
'*--cpu=vm[compile for Nim VM]' \
'*--cpu=wasm32[compile to WASM 32]' \
+ '*--cpu=loongarch64[compile for LoongArch64 architecture]' \
'*--gc=refc[use reference counting garbage collection]' \
'*--gc=arc[use ARC garbage collection]' \
'*--gc=orc[use ORC garbage collection]' \
--- nim-1.6.14.orig/tools/niminst/buildsh.nimf
+++ nim-1.6.14/tools/niminst/buildsh.nimf
@@ -227,6 +227,9 @@ case $ucpu in
mycpu="arm" ;;
*riscv64|riscv* )
mycpu="riscv64" ;;
+ *loongarch64* )
+ mycpu="loongarch64" ;;
+
*)
echo 2>&1 "Error: unknown processor: $ucpu"
exit 1
--- nim-1.6.14.orig/tools/niminst/makefile.nimf
+++ nim-1.6.14/tools/niminst/makefile.nimf
@@ -166,6 +166,9 @@ endif
ifeq ($(ucpu),riscv64)
mycpu = riscv64
endif
+ifeq ($(ucpu),loongarch64)
+ mycpu = loongarch64
+endif
ifndef mycpu
$(error unknown CPU architecture: $(ucpu) See makefile.nimf)
Reply to: