From 71ff56284571f955a95191603d9d1b5421eb9eb8 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 30 Jun 2025 14:11:10 -0700 Subject: [PATCH 1/3] Update to wasi-libc 205dd234880179180c9fe29bddb98a00eb2edd52. --- src/wasi-libc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wasi-libc b/src/wasi-libc index 640c0cfc1..205dd2348 160000 --- a/src/wasi-libc +++ b/src/wasi-libc @@ -1 +1 @@ -Subproject commit 640c0cfc19a96b099e0791824be5ef0105ce2084 +Subproject commit 205dd234880179180c9fe29bddb98a00eb2edd52 From 6c8d12d8a3acb44cf772faf4fb1dd1666fcaf7f4 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 2 Jul 2025 20:01:25 -0700 Subject: [PATCH 2/3] Update to the latest wasi-libc. --- src/wasi-libc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wasi-libc b/src/wasi-libc index 205dd2348..50ae11904 160000 --- a/src/wasi-libc +++ b/src/wasi-libc @@ -1 +1 @@ -Subproject commit 205dd234880179180c9fe29bddb98a00eb2edd52 +Subproject commit 50ae11904df674fecaa311537967fe138c21fcc7 From cee73ea8164f079f45859cb13e6abe5dd9f65ba8 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 30 Jun 2025 17:29:33 -0700 Subject: [PATCH 3/3] Pass BUILTINS_LIB to wasi-libc build Skip downloading one to use the just-built version. --- cmake/wasi-sdk-sysroot.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/wasi-sdk-sysroot.cmake b/cmake/wasi-sdk-sysroot.cmake index 37fa118cc..d7e64b94b 100644 --- a/cmake/wasi-sdk-sysroot.cmake +++ b/cmake/wasi-sdk-sysroot.cmake @@ -164,6 +164,12 @@ function(define_wasi_libc_sub target target_suffix lto) "${CMAKE_C_FLAGS} ${directory_cflags} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}") list(JOIN extra_cflags_list " " extra_cflags) + if(${target} MATCHES threads) + set(libcompiler_rt_a ${wasi_resource_dir}/lib/wasm32-unknown-wasip1-threads/libclang_rt.builtins.a) + else() + set(libcompiler_rt_a ${wasi_resource_dir}/lib/wasm32-unknown-wasip1/libclang_rt.builtins.a) + endif() + ExternalProject_Add(wasi-libc-${target}${target_suffix}-build # Currently wasi-libc doesn't support out-of-tree builds so feign a # "download command" which copies the source tree to a different location @@ -180,6 +186,7 @@ function(define_wasi_libc_sub target target_suffix lto) SYSROOT=${wasi_sysroot} EXTRA_CFLAGS=${extra_cflags} TARGET_TRIPLE=${target} + BUILTINS_LIB=${libcompiler_rt_a} ${extra_make_flags} INSTALL_COMMAND "" DEPENDS compiler-rt