-
-
Notifications
You must be signed in to change notification settings - Fork 411
Bionic bindings for AArch64 and a Glibc/AArch64 fix #2148
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,15 +175,28 @@ else version(NetBSD) | |
| } | ||
| else version (CRuntime_Bionic) | ||
| { | ||
| enum SIGRTMIN = 32; | ||
| version(ARM) | ||
| enum SIGRTMAX = 64; | ||
| else version(X86) | ||
| enum SIGRTMAX = 64; | ||
| else version(MIPS32) | ||
| enum SIGRTMAX = 128; | ||
| else | ||
| static assert(false, "Architecture not supported."); | ||
| // Switched to calling these functions since Lollipop | ||
| private extern (C) nothrow @nogc | ||
| { | ||
| int __libc_current_sigrtmin(); | ||
| int __libc_current_sigrtmax(); | ||
| } | ||
|
|
||
| @property int SIGRTMIN() nothrow @nogc { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this be a template?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a straight copy-and-paste of the Glibc block above, as Bionic switched to using the same function-calling scheme as Glibc. If you'd prefer that both blocks use template functions, I can modify them to that, don't care. |
||
| __gshared static int sig = -1; | ||
| if (sig == -1) { | ||
| sig = __libc_current_sigrtmin(); | ||
| } | ||
| return sig; | ||
| } | ||
|
|
||
| @property int SIGRTMAX() nothrow @nogc { | ||
| __gshared static int sig = -1; | ||
| if (sig == -1) { | ||
| sig = __libc_current_sigrtmax(); | ||
| } | ||
| return sig; | ||
| } | ||
| } | ||
| else version( CRuntime_UClibc ) | ||
| { | ||
|
|
@@ -760,7 +773,7 @@ else version( CRuntime_UClibc ) | |
| static assert(false, "Architecture not supported."); | ||
| } | ||
| } | ||
| else version (linux) | ||
| else version (CRuntime_Bionic) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I switched this to |
||
| { | ||
| version (X86) | ||
| { | ||
|
|
@@ -773,7 +786,7 @@ else version (linux) | |
| } | ||
|
|
||
| sigset_t sa_mask; | ||
| c_ulong sa_flags; | ||
| int sa_flags; | ||
| void function() sa_restorer; | ||
| } | ||
| } | ||
|
|
@@ -788,7 +801,22 @@ else version (linux) | |
| } | ||
|
|
||
| sigset_t sa_mask; | ||
| c_ulong sa_flags; | ||
| int sa_flags; | ||
| 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; | ||
| } | ||
| } | ||
|
|
@@ -1487,6 +1515,11 @@ else version( CRuntime_Bionic ) | |
| alias c_ulong sigset_t; | ||
| enum int LONG_BIT = 32; | ||
| } | ||
| else version (AArch64) | ||
| { | ||
| struct sigset_t { ulong[1] sig; } | ||
| enum int LONG_BIT = 64; | ||
| } | ||
| else | ||
| { | ||
| static assert(false, "Architecture not supported."); | ||
|
|
@@ -3018,6 +3051,34 @@ else version (CRuntime_Bionic) | |
| 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; | ||
|
|
||
| struct stack_t | ||
| { | ||
| void* ss_sp; | ||
| int ss_flags; | ||
| size_t ss_size; | ||
| } | ||
| } | ||
| else | ||
| { | ||
| static assert(false, "Architecture not supported."); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -238,12 +238,12 @@ else version( CRuntime_Bionic ) | |
| { | ||
| alias c_ulong blkcnt_t; | ||
| alias c_ulong blksize_t; | ||
| alias uint dev_t; | ||
| alias size_t dev_t; | ||
| alias uint gid_t; | ||
| alias c_ulong ino_t; | ||
| alias c_long off_t; | ||
| alias int pid_t; | ||
| alias int ssize_t; | ||
| alias c_long ssize_t; | ||
| alias c_long time_t; | ||
| alias uint uid_t; | ||
|
|
||
|
|
@@ -262,6 +262,11 @@ else version( CRuntime_Bionic ) | |
| alias ushort mode_t; | ||
| alias ushort nlink_t; | ||
| } | ||
| else version(AArch64) | ||
| { | ||
| alias uint mode_t; | ||
| alias uint nlink_t; | ||
| } | ||
| else version(MIPS32) | ||
| { | ||
| alias uint mode_t; | ||
|
|
@@ -418,7 +423,7 @@ else version( CRuntime_Bionic ) | |
| alias uint id_t; | ||
| alias int key_t; | ||
| alias c_long suseconds_t; | ||
| alias c_long useconds_t; | ||
| alias uint useconds_t; // Updated in Lollipop | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the bindings will only ever support one version of Android?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I believe every version since uses this now, just noting the version where the switch was made. |
||
| } | ||
| else version( CRuntime_Musl ) | ||
| { | ||
|
|
@@ -1051,6 +1056,7 @@ else version( CRuntime_Bionic ) | |
| size_t guard_size; | ||
| int sched_policy; | ||
| int sched_priority; | ||
| version(AArch64) char[16] __reserved; | ||
| } | ||
|
|
||
| struct pthread_cond_t | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This turned up when trying to run this Phobos test on linux/AArch64, dug this fix out of the Glibc headers. It appears Glibc uses these constants on AArch64 regardless of whether
__USE_FILE_OFFSET64is set or not, just like onx64.I don't want to go digging through the rat's nest of platform-specific Glibc headers to figure out why this is, so I just added this exception. If someone wants to do that digging and suggest a better way to normalize this, I'd be glad to make that change.