Backported from upstream druntime master.
Reviewed-on: https://github.com/dlang/druntime/pull/2355
From-SVN: r266713
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
alias fenv_t = double;
alias fexcept_t = uint;
}
+ // https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/riscv/bits/fenv.h
+ else version (RISCV_Any)
+ {
+ alias fenv_t = uint;
+ alias fexcept_t = uint;
+ }
// https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/sparc/fpu/bits/fenv.h
else version (SPARC64)
{
FE_DOWNWARD = 3, ///
}
}
+ else version (RISCV_Any)
+ {
+ // Define bits representing exceptions in the FPSR status word.
+ enum
+ {
+ FE_INEXACT = 0x01, ///
+ FE_UNDERFLOW = 0x02, ///
+ FE_OVERFLOW = 0x04, ///
+ FE_DIVBYZERO = 0x08, ///
+ FE_INVALID = 0x10, ///
+ FE_ALL_EXCEPT = 0x1f, ///
+ }
+
+ // Define bits representing rounding modes in the FPCR Rmode field.
+ enum
+ {
+ FE_TONEAREST = 0x0, ///
+ FE_TOWARDZERO = 0x1, ///
+ FE_DOWNWARD = 0x2, ///
+ FE_UPWARD = 0x3, ///
+ }
+ }
else version (SPARC_Any)
{
// Define bits representing the exception.
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
///
enum int FP_ILOGBNAN = int.max;
}
+ else version (RISCV_Any)
+ {
+ ///
+ enum int FP_ILOGB0 = -int.max;
+ ///
+ enum int FP_ILOGBNAN = int.max;
+ }
else version (SPARC_Any)
{
///
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
void _dl_mcount_wrapper_check(void* __selfpc);
}
}
+else version (RISCV_Any)
+{
+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
+ // enum RTLD_LAZY = 0x0001; // POSIX
+ // enum RTLD_NOW = 0x0002; // POSIX
+ enum RTLD_BINDING_MASK = 0x3;
+ enum RTLD_NOLOAD = 0x00004;
+ enum RTLD_DEEPBIND = 0x00008;
+
+ // enum RTLD_GLOBAL = 0x00100; // POSIX
+ // enum RTLD_LOCAL = 0; // POSIX
+ enum RTLD_NODELETE = 0x01000;
+
+ static if (__USE_GNU)
+ {
+ RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args)
+ {
+ _dl_mcount_wrapper_check(cast(void*)fctp);
+ return fctp(args);
+ }
+
+ void _dl_mcount_wrapper_check(void* __selfpc);
+ }
+}
else version (SPARC_Any)
{
// http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
epoll_data_t data;
}
}
+else version (RISCV_Any)
+{
+ struct epoll_event
+ {
+ uint events;
+ epoll_data_t data;
+ }
+}
else version (SPARC_Any)
{
struct epoll_event
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
version (X86) version = X86_Any;
alias __WORDSIZE __ELF_NATIVE_CLASS;
alias uint32_t Elf_Symndx;
}
+else version (RISCV_Any)
+{
+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
+ alias __WORDSIZE __ELF_NATIVE_CLASS;
+ alias uint32_t Elf_Symndx;
+}
else version (SPARC_Any)
{
// http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
enum EFD_CLOEXEC = 0x80000; // octal!2000000
enum EFD_NONBLOCK = 0x800; // octal!4000
}
+else version (RISCV_Any)
+{
+ enum EFD_SEMAPHORE = 1;
+ enum EFD_CLOEXEC = 0x80000; // octal!2000000
+ enum EFD_NONBLOCK = 0x800; // octal!4000
+}
else version (SPARC_Any)
{
enum EFD_SEMAPHORE = 1;
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
enum IN_CLOEXEC = 0x80000; // octal!2000000
enum IN_NONBLOCK = 0x800; // octal!4000
}
+else version (RISCV_Any)
+{
+ enum IN_CLOEXEC = 0x80000; // octal!2000000
+ enum IN_NONBLOCK = 0x800; // octal!4000
+}
else version (SPARC_Any)
{
enum IN_CLOEXEC = 0x80000; // octal!2000000
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
// MCL_FUTURE = 0x4000,
// }
}
+// https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/riscv/bits/mman.h
+else version (RISCV_Any)
+{
+ static if (__USE_MISC) enum
+ {
+ MAP_GROWSDOWN = 0x00100,
+ MAP_DENYWRITE = 0x00800,
+ MAP_EXECUTABLE = 0x01000,
+ MAP_LOCKED = 0x02000,
+ MAP_NORESERVE = 0x04000,
+ MAP_POPULATE = 0x08000,
+ MAP_NONBLOCK = 0x10000,
+ MAP_STACK = 0x20000,
+ MAP_HUGETLB = 0x40000,
+ MAP_SYNC = 0x80000,
+ MAP_FIXED_NOREPLACE = 0x100000,
+ }
+
+ // in core.sys.posix.sys.mman
+ // enum
+ // {
+ // MCL_CURRENT = 0x2000,
+ // MCL_FUTURE = 0x4000,
+ // }
+}
// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/s390/bits/mman.h
else version (IBMZ_Any)
{
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
enum RTLD_GLOBAL = 0x00100;
enum RTLD_LOCAL = 0;
}
+ else version (RISCV_Any)
+ {
+ enum RTLD_LAZY = 0x00001;
+ enum RTLD_NOW = 0x00002;
+ enum RTLD_GLOBAL = 0x00100;
+ enum RTLD_LOCAL = 0;
+ }
else version (SPARC_Any)
{
enum RTLD_LAZY = 0x00001;
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
enum O_DSYNC = 0x1000; // octal 010000
enum O_RSYNC = O_SYNC;
}
+ else version (RISCV_Any)
+ {
+ enum O_CREAT = 0x40; // octal 0100
+ enum O_EXCL = 0x80; // octal 0200
+ enum O_NOCTTY = 0x100; // octal 0400
+ enum O_TRUNC = 0x200; // octal 01000
+
+ enum O_APPEND = 0x400; // octal 02000
+ enum O_NONBLOCK = 0x800; // octal 04000
+ enum O_SYNC = 0x101000; // octal 04010000
+ enum O_DSYNC = 0x1000; // octal 010000
+ enum O_RSYNC = O_SYNC;
+ }
else version (SPARC_Any)
{
enum O_CREAT = 0x200;
version (Posix):
extern (C) nothrow @nogc:
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
+
//
// Required
//
double[6] __fpregs;
}
}
+ else version (RISCV_Any)
+ {
+ struct __riscv_jmp_buf
+ {
+ c_long __pc;
+ c_long[12] __regs;
+ c_long __sp;
+ double[12] __fpregs;
+ }
+ alias __jmp_buf = __riscv_jmp_buf[1];
+ }
else version (SystemZ)
{
struct __s390_jmp_buf
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
enum SIGUSR2 = 12;
enum SIGURG = 23;
}
+ else version (RISCV_Any)
+ {
+ //SIGABRT (defined in core.stdc.signal)
+ enum SIGALRM = 14;
+ enum SIGBUS = 7;
+ enum SIGCHLD = 17;
+ enum SIGCONT = 18;
+ //SIGFPE (defined in core.stdc.signal)
+ enum SIGHUP = 1;
+ //SIGILL (defined in core.stdc.signal)
+ //SIGINT (defined in core.stdc.signal)
+ enum SIGKILL = 9;
+ enum SIGPIPE = 13;
+ enum SIGQUIT = 3;
+ //SIGSEGV (defined in core.stdc.signal)
+ enum SIGSTOP = 19;
+ //SIGTERM (defined in core.stdc.signal)
+ enum SIGTSTP = 20;
+ enum SIGTTIN = 21;
+ enum SIGTTOU = 22;
+ enum SIGUSR1 = 10;
+ enum SIGUSR2 = 12;
+ enum SIGURG = 23;
+ }
else version (SPARC_Any)
{
//SIGABRT (defined in core.stdc.signal)
enum SIGXCPU = 24;
enum SIGXFSZ = 25;
}
+ else version (RISCV_Any)
+ {
+ enum SIGPOLL = 29;
+ enum SIGPROF = 27;
+ enum SIGSYS = 31;
+ enum SIGTRAP = 5;
+ enum SIGVTALRM = 26;
+ enum SIGXCPU = 24;
+ enum SIGXFSZ = 25;
+ }
else version (SPARC_Any)
{
enum SIGPOLL = 23;
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
enum MS_INVALIDATE = 2;
enum MS_SYNC = 4;
}
+ else version (RISCV_Any)
+ private enum DEFAULTS = true;
else version (SPARC_Any)
private enum DEFAULTS = true;
else version (PPC_Any)
c_ulong __glibc_reserved5;
}
}
+else version (RISCV32)
+{
+ // https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/generic/bits/msq.h
+ alias c_ulong msgqnum_t;
+ alias c_ulong msglen_t;
+
+ struct msqid_ds
+ {
+ ipc_perm msg_perm;
+ c_ulong __glibc_reserved1;
+ time_t msg_stime;
+ c_ulong __glibc_reserved2;
+ time_t msg_rtime;
+ c_ulong __glibc_reserved3;
+ time_t msg_ctime;
+ c_ulong __msg_cbytes;
+ msgqnum_t msg_qnum;
+ msglen_t msg_qbytes;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ c_ulong __glibc_reserved4;
+ c_ulong __glibc_reserved5;
+ }
+}
+else version (RISCV64)
+{
+ // https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/generic/bits/msq.h
+ alias c_ulong msgqnum_t;
+ alias c_ulong msglen_t;
+
+ struct msqid_ds
+ {
+ ipc_perm msg_perm;
+ time_t msg_stime;
+ time_t msg_rtime;
+ time_t msg_ctime;
+ c_ulong __msg_cbytes;
+ msgqnum_t msg_qnum;
+ msglen_t msg_qbytes;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ c_ulong __glibc_reserved4;
+ c_ulong __glibc_reserved5;
+ }
+}
else version (S390)
{
// https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/msq.h
version (MIPS64) version = MIPS_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
SO_TYPE = 3
}
}
+ else version (RISCV_Any)
+ {
+ enum
+ {
+ SOCK_DGRAM = 2,
+ SOCK_SEQPACKET = 5,
+ SOCK_STREAM = 1
+ }
+
+ enum
+ {
+ SOL_SOCKET = 1
+ }
+
+ enum
+ {
+ SO_ACCEPTCONN = 30,
+ SO_BROADCAST = 6,
+ SO_DEBUG = 1,
+ SO_DONTROUTE = 5,
+ SO_ERROR = 4,
+ SO_KEEPALIVE = 9,
+ SO_LINGER = 13,
+ SO_OOBINLINE = 10,
+ SO_RCVBUF = 8,
+ SO_RCVLOWAT = 18,
+ SO_RCVTIMEO = 20,
+ SO_REUSEADDR = 2,
+ SO_SNDBUF = 7,
+ SO_SNDLOWAT = 19,
+ SO_SNDTIMEO = 21,
+ SO_TYPE = 3
+ }
+ }
else version (SPARC_Any)
{
enum
else version (WatchOS)
version = Darwin;
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
+
version (Posix):
extern (C) nothrow @nogc:
c_ulong __unused6;
}
}
+ else version (RISCV_Any)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ dev_t __pad1;
+ off_t st_size;
+ blksize_t st_blksize;
+ int __pad2;
+ time_t st_atime;
+ c_ulong st_atime_nsec;
+ time_t st_mtime;
+ c_ulong st_mtime_nsec;
+ time_t st_ctime;
+ c_ulong st_ctime_nsec;
+ int[2] __reserved;
+ }
+ }
else version (ARM)
{
private
nothrow:
@nogc:
+version (RISCV32) version = RISCV_Any;
+version (RISCV64) version = RISCV_Any;
+
//
// XOpen (XSI)
//
mcontext_t uc_mcontext;
}
}
+ else version (RISCV_Any)
+ {
+ private
+ {
+ alias c_ulong[32] __riscv_mc_gp_state;
+
+ struct __riscv_mc_f_ext_state
+ {
+ uint[32] __f;
+ uint __fcsr;
+ }
+
+ struct __riscv_mc_d_ext_state
+ {
+ ulong[32] __f;
+ uint __fcsr;
+ }
+
+ struct __riscv_mc_q_ext_state
+ {
+ align(16) ulong[64] __f;
+ uint __fcsr;
+ uint[3] __reserved;
+ }
+
+ union __riscv_mc_fp_state
+ {
+ __riscv_mc_f_ext_state __f;
+ __riscv_mc_d_ext_state __d;
+ __riscv_mc_q_ext_state __q;
+ }
+ }
+
+ struct mcontext_t
+ {
+ __riscv_mc_gp_state __gregs;
+ __riscv_mc_fp_state __fpregs;
+ }
+
+ struct ucontext_t
+ {
+ c_ulong __uc_flags;
+ ucontext_t* uc_link;
+ stack_t uc_stack;
+ sigset_t uc_sigmask;
+ char[1024 / 8 - sigset_t.sizeof] __reserved;
+ mcontext_t uc_mcontext;
+ }
+ }
else version (SPARC64)
{
enum MC_NGREG = 19;
* each TLS block. This is at least true for PowerPC and Mips platforms.
* See: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/dl-tls.h;h=f7cf6f96ebfb505abfd2f02be0ad0e833107c0cd;hb=HEAD#l34
* https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mips/dl-tls.h;h=93a6dc050cb144b9f68b96fb3199c60f5b1fcd18;hb=HEAD#l32
+ * https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/riscv/dl-tls.h;h=ab2d860314de94c18812bc894ff6b3f55368f20f;hb=HEAD#l32
*/
version (X86)
- enum TLS_DTV_OFFSET = 0x;
+ enum TLS_DTV_OFFSET = 0x0;
else version (X86_64)
- enum TLS_DTV_OFFSET = 0x;
+ enum TLS_DTV_OFFSET = 0x0;
else version (ARM)
- enum TLS_DTV_OFFSET = 0x;
+ enum TLS_DTV_OFFSET = 0x0;
else version (AArch64)
- enum TLS_DTV_OFFSET = 0x;
+ enum TLS_DTV_OFFSET = 0x0;
+else version (RISCV32)
+ enum TLS_DTV_OFFSET = 0x800;
+else version (RISCV64)
+ enum TLS_DTV_OFFSET = 0x800;
else version (SPARC)
- enum TLS_DTV_OFFSET = 0x;
+ enum TLS_DTV_OFFSET = 0x0;
else version (SPARC64)
- enum TLS_DTV_OFFSET = 0x;
+ enum TLS_DTV_OFFSET = 0x0;
else version (PPC)
enum TLS_DTV_OFFSET = 0x8000;
else version (PPC64)