pmaports-a71/cross/gcc-armhf/0036-libphobos-add-riscv64-and-loongarch64-support.patch
2024-09-23 20:04:54 +02:00

88 lines
2.4 KiB
Diff

From: Celeste <cielesti@protonmail.com>
Date: Mon, 2 Sep 2024 02:54:17 +0000
Subject: [PATCH] libphobos: add riscv64 and loongarch64 support
Add musl support for these 2 architectures based on fenv.h and signal.h from:
https://git.musl-libc.org/cgit/musl/tree/arch/riscv64/bits?h=v1.2.5
https://git.musl-libc.org/cgit/musl/tree/arch/loongarch64/bits?h=v1.2.5
---
libphobos/libdruntime/core/stdc/fenv.d | 13 +++++++++++++
libphobos/libdruntime/core/sys/posix/signal.d | 10 ++++++++++
2 files changed, 23 insertions(+)
diff --git a/libphobos/libdruntime/core/stdc/fenv.d b/libphobos/libdruntime/core/stdc/fenv.d
index a7364c0a..5b327e4a 100644
--- a/libphobos/libdruntime/core/stdc/fenv.d
+++ b/libphobos/libdruntime/core/stdc/fenv.d
@@ -436,20 +436,33 @@ else version (CRuntime_Musl)
ushort __cs_selector;
ushort __opcode;
uint __data_offset;
ushort __data_selector;
ushort __unused5;
version (X86_64)
uint __mxcsr;
}
alias ushort fexcept_t;
}
+ else version (RISCV64)
+ {
+ alias uint fenv_t;
+ alias uint fexcept_t;
+ }
+ else version (LoongArch64)
+ {
+ struct fenv_t
+ {
+ uint __cw;
+ }
+ alias uint fexcept_t;
+ }
else
{
static assert(false, "Architecture not supported.");
}
}
else version (CRuntime_Newlib)
{
version (AArch64)
{
alias fenv_t = ulong;
diff --git a/libphobos/libdruntime/core/sys/posix/signal.d b/libphobos/libdruntime/core/sys/posix/signal.d
index a8b7f751..78d8b3cd 100644
--- a/libphobos/libdruntime/core/sys/posix/signal.d
+++ b/libphobos/libdruntime/core/sys/posix/signal.d
@@ -2751,20 +2751,30 @@ else version (CRuntime_Musl)
else version (PPC_Any)
{
enum MINSIGSTKSZ = 4096;
enum SIGSTKSZ = 10240;
}
else version (X86_Any)
{
enum MINSIGSTKSZ = 2048;
enum SIGSTKSZ = 8192;
}
+ else version (RISCV64)
+ {
+ enum MINSIGSTKSZ = 2048;
+ enum SIGSTKSZ = 8192;
+ }
+ else version (LoongArch64)
+ {
+ enum MINSIGSTKSZ = 4096;
+ enum SIGSTKSZ = 16384;
+ }
else
static assert(0, "unimplemented");
//ucontext_t (defined in core.sys.posix.ucontext)
//mcontext_t (defined in core.sys.posix.ucontext)
version (MIPS_Any)
{
struct stack_t
{