Skip to content

Commit f4497c6

Browse files
Improve s390x CPU support (#25056)
TODO list, copied from the documentation: - [x] compiler/platform.nim Add os/cpu properties. - [x] lib/system.nim Add os/cpu to the documentation for system.hostOS and system.hostCPU. - [x] ~~compiler/options.nim Add special os/cpu property checks in isDefined.~~ seems unnecessary; isn't dont for most CPUs - [x] compiler/installer.ini Add os/cpu to Project.Platforms field. - [x] lib/system/platforms.nim Add os/cpu. - [x] ~~std/private/osseps.nim Add os specializations.~~ - [x] ~~lib/pure/distros.nim Add os, package handler.~~ - [x] ~~tools/niminst/makefile.nimf Add os/cpu compiler/linker flags.~~ already done in #20943 - [x] tools/niminst/buildsh.nimf Add os/cpu compiler/linker flags. For csource: - [x] have compiler/platform.nim updated - [x] have compiler/installer.ini updated - [x] have tools/niminst/buildsh.nimf updated - [x] have tools/niminst/makefile.nimf updated - [ ] be backported to the Nim version used by the csources - [ ] the new csources must be pushed - [ ] the new csources revision must be updated in config/build_config.txt Additionally: - [x] check relation to #20943 Possible future work: - Porting Nim to s390x-specific operating systems, notably z/OS Co-authored-by: ringabout <[email protected]>
1 parent fed0053 commit f4497c6

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

compiler/installer.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Name: "Nim"
66
Version: "$version"
77
Platforms: """
88
windows: i386;amd64
9-
linux: i386;hppa;ia64;alpha;amd64;powerpc64;arm;sparc;sparc64;m68k;mips;mipsel;mips64;mips64el;powerpc;powerpc64el;arm64;riscv32;riscv64;loongarch64
9+
linux: i386;hppa;ia64;alpha;amd64;powerpc64;arm;sparc;sparc64;s390x;m68k;mips;mipsel;mips64;mips64el;powerpc;powerpc64el;arm64;riscv32;riscv64;loongarch64
1010
macosx: i386;amd64;powerpc64;arm64
1111
solaris: i386;amd64;sparc;sparc64
1212
freebsd: i386;amd64;powerpc64;arm;arm64;riscv64;sparc64;mips;mipsel;mips64;mips64el;powerpc;powerpc64el

compiler/platform.nim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ type
210210
cpuNone, cpuI386, cpuM68k, cpuAlpha, cpuPowerpc, cpuPowerpc64,
211211
cpuPowerpc64el, cpuSparc, cpuVm, cpuHppa, cpuIa64, cpuAmd64, cpuMips,
212212
cpuMipsel, cpuArm, cpuArm64, cpuJS, cpuNimVM, cpuAVR, cpuMSP430,
213-
cpuSparc64, cpuMips64, cpuMips64el, cpuRiscV32, cpuRiscV64, cpuEsp, cpuWasm32,
214-
cpuE2k, cpuLoongArch64
213+
cpuSparc64, cpuS390x, cpuMips64, cpuMips64el, cpuRiscV32, cpuRiscV64,
214+
cpuEsp, cpuWasm32, cpuE2k, cpuLoongArch64
215215

216216
type
217217
TInfoCPU* = tuple[name: string, intSize: int, endian: Endianness,
@@ -241,6 +241,7 @@ const
241241
(name: "avr", intSize: 16, endian: littleEndian, floatSize: 32, bit: 16),
242242
(name: "msp430", intSize: 16, endian: littleEndian, floatSize: 32, bit: 16),
243243
(name: "sparc64", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64),
244+
(name: "s390x", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64),
244245
(name: "mips64", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64),
245246
(name: "mips64el", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64),
246247
(name: "riscv32", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),

lib/system.nim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,8 @@ const
10691069
## Possible values:
10701070
## `"i386"`, `"alpha"`, `"powerpc"`, `"powerpc64"`, `"powerpc64el"`,
10711071
## `"sparc"`, `"amd64"`, `"mips"`, `"mipsel"`, `"arm"`, `"arm64"`,
1072-
## `"mips64"`, `"mips64el"`, `"riscv32"`, `"riscv64"`, `"loongarch64"`.
1072+
## `"mips64"`, `"mips64el"`, `"riscv32"`, `"riscv64"`, `"loongarch64"`,
1073+
## `"s390x"`.
10731074

10741075
seqShallowFlag = low(int)
10751076
strlitFlag = 1 shl (sizeof(int)*8 - 2) # later versions of the codegen \

tools/nim.zsh-completion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ _nim() {
7878
'--opt\:-[optimization mode]:x:(none speed size)'
7979
'--debugger\:native[use native debugger (gdb)]'
8080
'--app\:-[generate this type of app (lib=dynamic)]:x:(console gui lib staticlib)'
81-
'--cpu\:-[target architecture]:x:(alpha amd64 arm arm64 avr e2k esp hppa i386 ia64 js loongarch64 m68k mips mipsel mips64 mips64el msp430 nimvm powerpc powerpc64 powerpc64el riscv32 riscv64 sparc sparc64 vm wasm32)'
81+
'--cpu\:-[target architecture]:x:(alpha amd64 arm arm64 avr e2k esp hppa i386 ia64 js loongarch64 m68k mips mipsel mips64 mips64el msp430 nimvm powerpc powerpc64 powerpc64el riscv32 riscv64 sparc sparc64 s390x vm wasm32)'
8282
'--gc\:-[memory management algorithm to use (default\: refc)]:x:(refc arc orc markAndSweep boehm go regions none)'
8383
'--os\:-[operating system to compile for]:x:(AIX Amiga Android Any Atari DOS DragonFly FreeBSD FreeRTOS Genode Haiku iOS Irix JS Linux MacOS MacOSX MorphOS NetBSD Netware NimVM NintendoSwitch OS2 OpenBSD PalmOS Standalone QNX SkyOS Solaris VxWorks Windows)'
8484
'--panics\:-[turn panics into process termination (default\: off)]:x:(off on)'

tools/niminst/buildsh.nimf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ case $ucpu in
183183
fi
184184
fi
185185
;;
186+
*s390x* )
187+
mycpu="s390x" ;;
186188
*ppc64le* )
187189
mycpu="powerpc64el" ;;
188190
*ppc64* )

0 commit comments

Comments
 (0)