diff --git a/src/core/stdc/fenv.d b/src/core/stdc/fenv.d index bcd6e40d51..f0aa107808 100644 --- a/src/core/stdc/fenv.d +++ b/src/core/stdc/fenv.d @@ -312,6 +312,24 @@ else version (CRuntime_Bionic) alias uint fexcept_t; } + else version (X86_64) + { + struct fenv_t + { + struct _x87 + { + uint __control; + uint __status; + uint __tag; + uint[4] __others; + } + _x87 __x87; + + uint __mxcsr; + } + + alias uint fexcept_t; + } else { static assert(false, "Architecture not supported."); diff --git a/src/core/sys/posix/config.d b/src/core/sys/posix/config.d index 43e2a47516..61de95802c 100644 --- a/src/core/sys/posix/config.d +++ b/src/core/sys/posix/config.d @@ -107,6 +107,10 @@ else version (CRuntime_UClibc) else enum __WORDSIZE=32; } +else version (CRuntime_Bionic) +{ + enum __USE_GNU = false; +} else version (Solaris) { enum _FILE_OFFSET_BITS = 64; diff --git a/src/core/sys/posix/fcntl.d b/src/core/sys/posix/fcntl.d index 339dcd4910..808fa2e803 100644 --- a/src/core/sys/posix/fcntl.d +++ b/src/core/sys/posix/fcntl.d @@ -744,42 +744,21 @@ else version (CRuntime_Bionic) enum F_WRLCK = 1; enum F_UNLCK = 2; - version (X86) - { - 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_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 = 0x1000; // octal 010000 - } - else version (ARM) - { - 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_APPEND = 0x400; // octal 02000 - enum O_NONBLOCK = 0x800; // octal 04000 - enum O_SYNC = 0x1000; // octal 010000 - } - else version (AArch64) + version (D_LP64) { - 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_SYNC = 0x101000; // octal 04010000 } else { - static assert(false, "Architecture not supported."); + enum O_SYNC = 0x1000; // octal 010000 } enum O_ACCMODE = 0x3; diff --git a/src/core/sys/posix/setjmp.d b/src/core/sys/posix/setjmp.d index 6a0264f754..55167b30c5 100644 --- a/src/core/sys/posix/setjmp.d +++ b/src/core/sys/posix/setjmp.d @@ -269,6 +269,10 @@ else version (CRuntime_Bionic) { enum _JBLEN = 32; } + else version (X86_64) + { + enum _JBLEN = 11; + } else { static assert(false, "Architecture not supported."); @@ -480,4 +484,4 @@ else version (CRuntime_UClibc) { int _setjmp(ref jmp_buf); void _longjmp(ref jmp_buf, int); -} \ No newline at end of file +} diff --git a/src/core/sys/posix/signal.d b/src/core/sys/posix/signal.d index 6f770583cc..6749ecfdfd 100644 --- a/src/core/sys/posix/signal.d +++ b/src/core/sys/posix/signal.d @@ -775,10 +775,11 @@ else version (CRuntime_UClibc) } else version (CRuntime_Bionic) { - version (X86) + version (D_LP64) { struct sigaction_t { + int sa_flags; union { sigfn_t sa_handler; @@ -786,11 +787,10 @@ else version (CRuntime_Bionic) } sigset_t sa_mask; - int sa_flags; void function() sa_restorer; } } - else version (ARM) + else { struct sigaction_t { @@ -805,25 +805,6 @@ else version (CRuntime_Bionic) void function() sa_restorer; } } - else version (AArch64) - { - struct sigaction_t - { - int sa_flags; - union - { - sigfn_t sa_handler; - sigactfn_t sa_sigaction; - } - - sigset_t sa_mask; - void function() sa_restorer; - } - } - else - { - static assert(false, "Architecture not supported."); - } } else version (Darwin) { @@ -1507,12 +1488,12 @@ else version (CRuntime_Bionic) version (X86) { - alias c_ulong sigset_t; + alias uint sigset_t; enum int LONG_BIT = 32; } else version (ARM) { - alias c_ulong sigset_t; + alias uint sigset_t; enum int LONG_BIT = 32; } else version (AArch64) @@ -1520,6 +1501,11 @@ else version (CRuntime_Bionic) struct sigset_t { ulong[1] sig; } enum int LONG_BIT = 64; } + else version (X86_64) + { + alias ulong sigset_t; + enum int LONG_BIT = 64; + } else { static assert(false, "Architecture not supported."); @@ -2995,93 +2981,30 @@ else version (Solaris) } else version (CRuntime_Bionic) { - version (X86) - { - enum SIGPOLL = 29; - enum SIGPROF = 27; - enum SIGSYS = 31; - enum SIGTRAP = 5; - enum SIGVTALRM = 26; - enum SIGXCPU = 24; - enum SIGXFSZ = 25; - - enum SA_ONSTACK = 0x08000000; - enum SA_RESETHAND = 0x80000000; - enum SA_RESTART = 0x10000000; - enum SA_SIGINFO = 4; - enum SA_NOCLDWAIT = 2; - enum SA_NODEFER = 0x40000000; - enum SS_ONSTACK = 1; - enum SS_DISABLE = 2; - enum MINSIGSTKSZ = 2048; - enum SIGSTKSZ = 8192; + enum SIGPOLL = 29; + enum SIGPROF = 27; + enum SIGSYS = 31; + enum SIGTRAP = 5; + enum SIGVTALRM = 26; + enum SIGXCPU = 24; + enum SIGXFSZ = 25; - struct stack_t - { - void* ss_sp; - int ss_flags; - size_t ss_size; - } - } - else version (ARM) - { - enum SIGPOLL = 29; - enum SIGPROF = 27; - enum SIGSYS = 31; - enum SIGTRAP = 5; - enum SIGVTALRM = 26; - enum SIGXCPU = 24; - enum SIGXFSZ = 25; - - enum SA_ONSTACK = 0x08000000; - enum SA_RESETHAND = 0x80000000; - enum SA_RESTART = 0x10000000; - enum SA_SIGINFO = 4; - enum SA_NOCLDWAIT = 2; - enum SA_NODEFER = 0x40000000; - enum SS_ONSTACK = 1; - enum SS_DISABLE = 2; - enum MINSIGSTKSZ = 2048; - enum SIGSTKSZ = 8192; - - struct stack_t - { - void* ss_sp; - int ss_flags; - size_t ss_size; - } - } - else version (AArch64) - { - enum SIGPOLL = 29; - enum SIGPROF = 27; - enum SIGSYS = 31; - enum SIGTRAP = 5; - enum SIGVTALRM = 26; - enum SIGXCPU = 24; - enum SIGXFSZ = 25; - - enum SA_ONSTACK = 0x08000000; - enum SA_RESETHAND = 0x80000000; - enum SA_RESTART = 0x10000000; - enum SA_SIGINFO = 4; - enum SA_NOCLDWAIT = 2; - enum SA_NODEFER = 0x40000000; - enum SS_ONSTACK = 1; - enum SS_DISABLE = 2; - enum MINSIGSTKSZ = 2048; - enum SIGSTKSZ = 8192; + enum SA_ONSTACK = 0x08000000; + enum SA_RESETHAND = 0x80000000; + enum SA_RESTART = 0x10000000; + enum SA_SIGINFO = 4; + enum SA_NOCLDWAIT = 2; + enum SA_NODEFER = 0x40000000; + enum SS_ONSTACK = 1; + enum SS_DISABLE = 2; + enum MINSIGSTKSZ = 2048; + enum SIGSTKSZ = 8192; - struct stack_t - { - void* ss_sp; - int ss_flags; - size_t ss_size; - } - } - else + struct stack_t { - static assert(false, "Architecture not supported."); + void* ss_sp; + int ss_flags; + size_t ss_size; } enum diff --git a/src/core/sys/posix/sys/ipc.d b/src/core/sys/posix/sys/ipc.d index f9f17e0c6e..095c81ba41 100644 --- a/src/core/sys/posix/sys/ipc.d +++ b/src/core/sys/posix/sys/ipc.d @@ -176,21 +176,22 @@ else version (DragonFlyBSD) } else version (CRuntime_Bionic) { - // All except ftok are from the linux kernel headers. - version (X86) + // All except ftok are from the linux kernel headers. Latest Bionic headers + // don't use this legacy definition anymore, consider updating. + version (D_LP64) { struct ipc_perm { key_t key; - ushort uid; - ushort gid; - ushort cuid; - ushort cgid; + uint uid; + uint gid; + uint cuid; + uint cgid; mode_t mode; ushort seq; } } - else version (ARM) + else { struct ipc_perm { @@ -203,23 +204,6 @@ else version (CRuntime_Bionic) ushort seq; } } - else version (AArch64) - { - struct ipc_perm - { - key_t key; - uint uid; - uint gid; - uint cuid; - uint cgid; - mode_t mode; - ushort seq; - } - } - else - { - static assert(false, "Architecture not supported."); - } enum IPC_CREAT = 0x0200; // 01000 enum IPC_EXCL = 0x0400; // 02000 diff --git a/src/core/sys/posix/sys/mman.d b/src/core/sys/posix/sys/mman.d index b9da7348ff..49ad142f0c 100644 --- a/src/core/sys/posix/sys/mman.d +++ b/src/core/sys/posix/sys/mman.d @@ -465,23 +465,7 @@ else version (CRuntime_Bionic) enum MAP_SHARED = 0x0001; enum MAP_PRIVATE = 0x0002; enum MAP_FIXED = 0x0010; - - version (X86) - { - enum MAP_ANON = 0x0020; - } - else version (ARM) - { - enum MAP_ANON = 0x0020; - } - else version (AArch64) - { - enum MAP_ANON = 0x0020; - } - else - { - static assert(false, "Architecture not supported."); - } + enum MAP_ANON = 0x0020; enum MAP_FAILED = cast(void*)-1; diff --git a/src/core/sys/posix/sys/socket.d b/src/core/sys/posix/sys/socket.d index 6a82918aab..65c0ba1316 100644 --- a/src/core/sys/posix/sys/socket.d +++ b/src/core/sys/posix/sys/socket.d @@ -1698,117 +1698,38 @@ else version (CRuntime_Bionic) int cmsg_type; } - version (X86) - { - alias uint __kernel_size_t; - - enum - { - SOCK_DGRAM = 2, - SOCK_SEQPACKET = 5, - SOCK_STREAM = 1 - } - - enum - { - SOL_SOCKET = 1 - } + alias size_t __kernel_size_t; - 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 (ARM) + enum { - alias uint __kernel_size_t; - - 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 - } + SOCK_DGRAM = 2, + SOCK_SEQPACKET = 5, + SOCK_STREAM = 1 } - else version (AArch64) - { - alias ulong __kernel_size_t; - 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 - } + enum + { + SOL_SOCKET = 1 } - else + + enum { - static assert(false, "Architecture not supported."); + 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 } enum diff --git a/src/core/sys/posix/sys/stat.d b/src/core/sys/posix/sys/stat.d index 7a05e5287e..82a094c86c 100644 --- a/src/core/sys/posix/sys/stat.d +++ b/src/core/sys/posix/sys/stat.d @@ -1239,6 +1239,31 @@ else version (CRuntime_Bionic) uint __unused5; } } + else version (X86_64) + { + struct stat_t + { + ulong st_dev; + ulong st_ino; + ulong st_nlink; + uint st_mode; + uid_t st_uid; + gid_t st_gid; + uint __pad0; + + ulong st_rdev; + long st_size; + long st_blksize; + long st_blocks; + long st_atime; + ulong st_atime_nsec; + long st_mtime; + ulong st_mtime_nsec; + long st_ctime; + ulong st_ctime_nsec; + long[3] __pad3; + } + } else { static assert(false, "Architecture not supported."); diff --git a/src/core/sys/posix/sys/types.d b/src/core/sys/posix/sys/types.d index 185f566152..6e29436af0 100644 --- a/src/core/sys/posix/sys/types.d +++ b/src/core/sys/posix/sys/types.d @@ -247,34 +247,15 @@ else version (CRuntime_Bionic) alias c_long time_t; alias uint uid_t; - version (X86) - { - alias ushort mode_t; - alias ushort nlink_t; - } - else version (X86_64) - { - alias ushort mode_t; - alias uint nlink_t; - } - else version (ARM) - { - alias ushort mode_t; - alias ushort nlink_t; - } - else version (AArch64) - { - alias uint mode_t; - alias uint nlink_t; - } - else version (MIPS32) + version (D_LP64) { alias uint mode_t; alias uint nlink_t; } else { - static assert(false, "Architecture not supported."); + alias ushort mode_t; + alias ushort nlink_t; } } else version (CRuntime_UClibc) diff --git a/src/rt/sections_android.d b/src/rt/sections_android.d index 63936450b8..34168d57d4 100644 --- a/src/rt/sections_android.d +++ b/src/rt/sections_android.d @@ -107,43 +107,14 @@ void scanTLSRanges(void[]* rng, scope void delegate(void* pbeg, void* pend) noth * the corresponding address in the TLS dynamic per-thread data. */ -version (X86) +extern(C) void* __tls_get_addr( void* p ) nothrow @nogc { - // NB: the compiler mangles this function as '___tls_get_addr' - // even though it is extern(D) - extern(D) void* ___tls_get_addr( void* p ) nothrow @nogc - { - debug(PRINTF) printf(" ___tls_get_addr input - %p\n", p); - immutable offset = cast(size_t)(p - cast(void*)&_tlsstart); - auto tls = getTLSBlockAlloc(); - assert(offset < tls.length); - return tls.ptr + offset; - } -} -else version (ARM) -{ - extern(C) void* __tls_get_addr( void** p ) nothrow @nogc - { - debug(PRINTF) printf(" __tls_get_addr input - %p\n", *p); - immutable offset = cast(size_t)(*p - cast(void*)&_tlsstart); - auto tls = getTLSBlockAlloc(); - assert(offset < tls.length); - return tls.ptr + offset; - } -} -else version (AArch64) -{ - extern(C) void* __tls_get_addr( void* p ) nothrow @nogc - { - debug(PRINTF) printf(" __tls_get_addr input - %p\n", p); - immutable offset = cast(size_t)(p - cast(void*)&_tlsstart); - auto tls = getTLSBlockAlloc(); - assert(offset < tls.length); - return tls.ptr + offset; - } + debug(PRINTF) printf(" __tls_get_addr input - %p\n", p); + immutable offset = cast(size_t)(p - cast(void*)&_tlsstart); + auto tls = getTLSBlockAlloc(); + assert(offset < tls.length); + return tls.ptr + offset; } -else - static assert( false, "Android architecture not supported." ); private: