diff --git a/Makefile b/Makefile index 542b43eb..174115e2 100644 --- a/Makefile +++ b/Makefile @@ -288,12 +288,16 @@ LIBC_TOP_HALF_MUSL_SOURCES += \ thread/pthread_attr_destroy.c \ thread/pthread_attr_get.c \ thread/pthread_attr_init.c \ - thread/pthread_attr_setstack.c \ thread/pthread_attr_setdetachstate.c \ + thread/pthread_attr_setguardsize.c \ + thread/pthread_attr_setstack.c \ thread/pthread_attr_setstacksize.c \ thread/pthread_barrier_destroy.c \ thread/pthread_barrier_init.c \ thread/pthread_barrier_wait.c \ + thread/pthread_barrierattr_destroy.c \ + thread/pthread_barrierattr_init.c \ + thread/pthread_barrierattr_setpshared.c \ thread/pthread_cleanup_push.c \ thread/pthread_cond_broadcast.c \ thread/pthread_cond_destroy.c \ diff --git a/expected/wasm32-wasip1-threads/defined-symbols.txt b/expected/wasm32-wasip1-threads/defined-symbols.txt index 730648fe..822a559c 100644 --- a/expected/wasm32-wasip1-threads/defined-symbols.txt +++ b/expected/wasm32-wasip1-threads/defined-symbols.txt @@ -992,12 +992,16 @@ pthread_attr_getstack pthread_attr_getstacksize pthread_attr_init pthread_attr_setdetachstate +pthread_attr_setguardsize pthread_attr_setstack pthread_attr_setstacksize pthread_barrier_destroy pthread_barrier_init pthread_barrier_wait +pthread_barrierattr_destroy pthread_barrierattr_getpshared +pthread_barrierattr_init +pthread_barrierattr_setpshared pthread_cond_broadcast pthread_cond_destroy pthread_cond_init diff --git a/libc-top-half/musl/src/thread/pthread_attr_setguardsize.c b/libc-top-half/musl/src/thread/pthread_attr_setguardsize.c index 1c5c60ac..589ff676 100644 --- a/libc-top-half/musl/src/thread/pthread_attr_setguardsize.c +++ b/libc-top-half/musl/src/thread/pthread_attr_setguardsize.c @@ -2,7 +2,12 @@ int pthread_attr_setguardsize(pthread_attr_t *a, size_t size) { +#ifdef __wasilibc_unmodified_upstream if (size > SIZE_MAX/8) return EINVAL; +#else + /* WASI doesn't have memory protection required for stack guards. */ + if (size > 0) return EINVAL; +#endif a->_a_guardsize = size; return 0; } diff --git a/libc-top-half/musl/src/thread/pthread_mutexattr_setrobust.c b/libc-top-half/musl/src/thread/pthread_mutexattr_setrobust.c index 649a8913..68c7d65d 100644 --- a/libc-top-half/musl/src/thread/pthread_mutexattr_setrobust.c +++ b/libc-top-half/musl/src/thread/pthread_mutexattr_setrobust.c @@ -22,6 +22,7 @@ int pthread_mutexattr_setrobust(pthread_mutexattr_t *a, int robust) a->__attr &= ~4; return 0; #else - return EINVAL; + if (robust) return EINVAL; + return 0; #endif }