Skip to content

Commit c841cdd

Browse files
committed
wip
1 parent 5faf808 commit c841cdd

9 files changed

Lines changed: 659 additions & 271 deletions

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
1111
project(wasi-sdk)
1212
include(ExternalProject)
1313

14-
set(WASI_SDK_TARGETS "wasm32-wasi;wasm32-wasip1;wasm32-wasip2;wasm32-wasip1-threads;wasm32-wasi-threads"
14+
set(WASI_SDK_TARGETS "wasm32-wasi;wasm32-wasip1;wasm32-wasip2;wasm32-wasip3;wasm32-wasip1-threads;wasm32-wasi-threads"
1515
CACHE STRING "List of WASI targets to build")
1616
option(WASI_SDK_BUILD_TOOLCHAIN "Build a toolchain instead of the sysroot" OFF)
1717

cmake/wasi-sdk-sysroot.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ function(define_wasi_libc_sub target target_suffix lto)
186186

187187
if(${target} MATCHES threads)
188188
set(libcompiler_rt_a ${wasi_resource_dir}/lib/wasm32-unknown-wasip1-threads/libclang_rt.builtins.a)
189+
elseif(${target} MATCHES wasip3)
190+
set(libcompiler_rt_a ${wasi_resource_dir}/lib/wasm32-unknown-wasip3/libclang_rt.builtins.a)
189191
else()
190192
set(libcompiler_rt_a ${wasi_resource_dir}/lib/wasm32-unknown-wasip1/libclang_rt.builtins.a)
191193
endif()
@@ -375,7 +377,7 @@ function(define_libcxx_sub target target_suffix extra_target_flags extra_libdir_
375377
"git apply ${CMAKE_SOURCE_DIR}/src/llvm-pr-186054.patch || git apply ${CMAKE_SOURCE_DIR}/src/llvm-pr-186054.patch -R --check"
376378
COMMAND
377379
${CMAKE_COMMAND} -E chdir .. bash -c
378-
"git apply ${CMAKE_SOURCE_DIR}/src/llvm-pr-185770.patch || git apply ${CMAKE_SOURCE_DIR}/src/llvm-pr-185770.patch -R --check"
380+
"git apply ${CMAKE_SOURCE_DIR}/src/llvm-undo-part-of-194317.patch || git apply ${CMAKE_SOURCE_DIR}/src/llvm-undo-part-of-194317.patch -R --check"
379381
)
380382
add_dependencies(libcxx-${target} libcxx-${target}${target_suffix}-build)
381383
endfunction()

cmake/wasi-sdk-toolchain.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ ExternalProject_Add(llvm-build
250250
USES_TERMINAL_INSTALL ON
251251
PATCH_COMMAND
252252
${CMAKE_COMMAND} -E chdir .. bash -c
253-
"git apply ${CMAKE_SOURCE_DIR}/src/llvm-pr-185775.patch || git apply ${CMAKE_SOURCE_DIR}/src/llvm-pr-185775.patch -R --check"
253+
"git apply ${CMAKE_SOURCE_DIR}/src/llvm-pr-200855.patch || git apply ${CMAKE_SOURCE_DIR}/src/llvm-pr-200855.patch -R --check"
254254
)
255255

256256
add_custom_target(build ALL DEPENDS llvm-build)
@@ -265,7 +265,7 @@ install(DIRECTORY ${wasi_tmp_install}/bin ${wasi_tmp_install}/lib ${wasi_tmp_ins
265265
# Build logic for `wasm-component-ld` installed from Rust code.
266266
set(wasm_component_ld_root ${CMAKE_CURRENT_BINARY_DIR}/wasm-component-ld)
267267
set(wasm_component_ld ${wasm_component_ld_root}/bin/wasm-component-ld${CMAKE_EXECUTABLE_SUFFIX})
268-
set(wasm_component_ld_version 0.5.22)
268+
set(wasm_component_ld_version 0.5.24)
269269
if(RUST_TARGET)
270270
set(rust_target_flag --target=${RUST_TARGET})
271271
endif()

src/llvm-pr-185770.patch

Lines changed: 0 additions & 105 deletions
This file was deleted.

src/llvm-pr-185775.patch

Lines changed: 0 additions & 152 deletions
This file was deleted.

src/llvm-pr-186054.patch

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
From f71fdfcbd6fcc7b521c74b5856ebeacdd6cf55d9 Mon Sep 17 00:00:00 2001
1+
From 46301f073b8cc85ad0d2f1dcdda923209bff173b Mon Sep 17 00:00:00 2001
22
From: Catherine <whitequark@whitequark.org>
33
Date: Thu, 12 Mar 2026 08:19:49 +0000
44
Subject: [PATCH] [libc++abi] Revert gating of `__cxa_thread_atexit` on
5-
Linux||Fuchsia
5+
Wasm/WASI
66

77
This was done in the commit 3c100d5d548d with the description
88
"Enable -Wmissing-prototypes" which seems incongruent to me.
@@ -23,26 +23,28 @@ wasm-ld: error: /tmp/repro-dd1ad7.o: undefined symbol: __cxa_thread_atexit
2323
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
2424
```
2525
---
26-
libcxxabi/src/cxa_thread_atexit.cpp | 4 +---
27-
1 file changed, 1 insertion(+), 3 deletions(-)
26+
libcxxabi/src/cxa_thread_atexit.cpp | 5 +++--
27+
1 file changed, 3 insertions(+), 2 deletions(-)
2828

2929
diff --git a/libcxxabi/src/cxa_thread_atexit.cpp b/libcxxabi/src/cxa_thread_atexit.cpp
30-
index 402a52c741012..1bdcb4ef192b4 100644
30+
index 402a52c741012..099be242c6dc6 100644
3131
--- a/libcxxabi/src/cxa_thread_atexit.cpp
3232
+++ b/libcxxabi/src/cxa_thread_atexit.cpp
33-
@@ -106,7 +106,6 @@ namespace {
33+
@@ -106,7 +106,7 @@ namespace {
3434

3535
#endif // HAVE___CXA_THREAD_ATEXIT_IMPL
3636

3737
-#if defined(__linux__) || defined(__Fuchsia__)
38+
+#if defined(__linux__) || defined(__Fuchsia__) || defined(__wasm__)
3839
extern "C" {
3940

4041
_LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(Dtor dtor, void* obj, void* dso_symbol) throw() {
41-
@@ -141,6 +140,5 @@ extern "C" {
42+
@@ -141,6 +141,7 @@ extern "C" {
4243
}
4344
#endif // HAVE___CXA_THREAD_ATEXIT_IMPL
4445
}
45-
-} // extern "C"
46+
+
47+
} // extern "C"
4648
-#endif // defined(__linux__) || defined(__Fuchsia__)
47-
+ } // extern "C"
49+
+#endif // defined(__linux__) || defined(__Fuchsia__) || defined(__wasm__)
4850
} // namespace __cxxabiv1

0 commit comments

Comments
 (0)