Skip to content

Commit 154320d

Browse files
committed
add Android pthread support
1 parent 7781c2f commit 154320d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ci/ci.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ case $HOST_TARGET in
154154
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX threadname pthread libc-time fs
155155
TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX threadname pthread sync available-parallelism libc-time tls
156156
TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX threadname pthread sync available-parallelism libc-time tls
157-
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX
157+
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX pthread --skip threadname --skip pthread_cond_timedwait
158158
TEST_TARGET=wasm32-wasip2 run_tests_minimal empty_main wasm heap_alloc libc-mem
159159
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal empty_main wasm
160160
TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std

src/shims/unix/sync.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::*;
1111
#[inline]
1212
fn mutexattr_kind_offset<'tcx>(ecx: &MiriInterpCx<'tcx>) -> InterpResult<'tcx, u64> {
1313
Ok(match &*ecx.tcx.sess.target.os {
14-
"linux" | "illumos" | "solaris" | "macos" | "freebsd" => 0,
14+
"linux" | "illumos" | "solaris" | "macos" | "freebsd" | "android" => 0,
1515
os => throw_unsup_format!("`pthread_mutexattr` is not supported on {os}"),
1616
})
1717
}
@@ -76,7 +76,7 @@ fn mutex_id_offset<'tcx>(ecx: &MiriInterpCx<'tcx>) -> InterpResult<'tcx, u64> {
7676
// When adding a new OS, make sure we also support all its static initializers in
7777
// `mutex_kind_from_static_initializer`!
7878
let offset = match &*ecx.tcx.sess.target.os {
79-
"linux" | "illumos" | "solaris" | "freebsd" => 0,
79+
"linux" | "illumos" | "solaris" | "freebsd" | "android" => 0,
8080
// macOS stores a signature in the first bytes, so we have to move to offset 4.
8181
"macos" => 4,
8282
os => throw_unsup_format!("`pthread_mutex` is not supported on {os}"),
@@ -105,7 +105,7 @@ fn mutex_id_offset<'tcx>(ecx: &MiriInterpCx<'tcx>) -> InterpResult<'tcx, u64> {
105105
check_static_initializer("PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP");
106106
check_static_initializer("PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP");
107107
}
108-
"illumos" | "solaris" | "macos" | "freebsd" => {
108+
"illumos" | "solaris" | "macos" | "freebsd" | "android" => {
109109
// No non-standard initializers.
110110
}
111111
os => throw_unsup_format!("`pthread_mutex` is not supported on {os}"),
@@ -216,7 +216,7 @@ pub struct AdditionalRwLockData {
216216

217217
fn rwlock_id_offset<'tcx>(ecx: &MiriInterpCx<'tcx>) -> InterpResult<'tcx, u64> {
218218
let offset = match &*ecx.tcx.sess.target.os {
219-
"linux" | "illumos" | "solaris" | "freebsd" => 0,
219+
"linux" | "illumos" | "solaris" | "freebsd" | "android" => 0,
220220
// macOS stores a signature in the first bytes, so we have to move to offset 4.
221221
"macos" => 4,
222222
os => throw_unsup_format!("`pthread_rwlock` is not supported on {os}"),
@@ -269,7 +269,7 @@ fn rwlock_get_id<'tcx>(
269269
#[inline]
270270
fn condattr_clock_offset<'tcx>(ecx: &MiriInterpCx<'tcx>) -> InterpResult<'tcx, u64> {
271271
Ok(match &*ecx.tcx.sess.target.os {
272-
"linux" | "illumos" | "solaris" | "freebsd" => 0,
272+
"linux" | "illumos" | "solaris" | "freebsd" | "android" => 0,
273273
// macOS does not have a clock attribute.
274274
os => throw_unsup_format!("`pthread_condattr` clock field is not supported on {os}"),
275275
})
@@ -321,7 +321,7 @@ fn condattr_set_clock_id<'tcx>(
321321

322322
fn cond_id_offset<'tcx>(ecx: &MiriInterpCx<'tcx>) -> InterpResult<'tcx, u64> {
323323
let offset = match &*ecx.tcx.sess.target.os {
324-
"linux" | "illumos" | "solaris" | "freebsd" => 0,
324+
"linux" | "illumos" | "solaris" | "freebsd" | "android" => 0,
325325
// macOS stores a signature in the first bytes, so we have to move to offset 4.
326326
"macos" => 4,
327327
os => throw_unsup_format!("`pthread_cond` is not supported on {os}"),

0 commit comments

Comments
 (0)