Skip to content

libcxx: enable tests against wasi-libc - #215384

Open
MaxDesiatov wants to merge 3 commits into
llvm:mainfrom
MaxDesiatov:maxd/wasi-libcxx
Open

MaxDesiatov wants to merge 3 commits into
llvm:mainfrom
MaxDesiatov:maxd/wasi-libcxx

Conversation

@MaxDesiatov

Copy link
Copy Markdown
Contributor

libc++ has no WebAssembly test coverage. This adds two builders, wasm32-wasip1 and wasm32-wasip1-no-exceptions.

Tests that wasi-libc or the wasm ABI cannot satisfy carry a new LIBCXX-WASI-FIXME feature, following the existing picolibc and AIX markers.

Two source changes are included:

  • libunwind/src/config.h no longer marks symbols dllexport on wasm.
  • libcxxabi/src/cxa_personality.cpp suppresses an unused-variable warning for lpStart, matching the existing suppression for callSiteEncoding.

@MaxDesiatov
MaxDesiatov requested review from a team as code owners August 10, 2026 20:19
@llvmorg-github-actions llvmorg-github-actions Bot added libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. libc++abi libc++abi C++ Runtime Library. Not libc++. libunwind labels Aug 10, 2026
@llvmorg-github-actions

llvmorg-github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

@llvm/pr-subscribers-github-workflow
@llvm/pr-subscribers-libunwind
@llvm/pr-subscribers-libcxx

@llvm/pr-subscribers-libcxxabi

Author: Max Desiatov (MaxDesiatov)

Changes

libc++ has no WebAssembly test coverage. This adds two builders, wasm32-wasip1 and wasm32-wasip1-no-exceptions.

Tests that wasi-libc or the wasm ABI cannot satisfy carry a new LIBCXX-WASI-FIXME feature, following the existing picolibc and AIX markers.

Two source changes are included:

  • libunwind/src/config.h no longer marks symbols dllexport on wasm.
  • libcxxabi/src/cxa_personality.cpp suppresses an unused-variable warning for lpStart, matching the existing suppression for callSiteEncoding.

Patch is 41.18 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/215384.diff

42 Files Affected:

  • (added) libcxx/cmake/caches/WASI.cmake (+53)
  • (added) libcxx/test/configs/wasm32-wasip1-libc++.cfg.in (+39)
  • (modified) libcxx/test/extensions/clang/clang_modules_include.gen.py (+3)
  • (modified) libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp (+3)
  • (modified) libcxx/test/libcxx/containers/associative/map/at.abort.pass.cpp (+3)
  • (modified) libcxx/test/libcxx/containers/associative/map/at.const.abort.pass.cpp (+3)
  • (modified) libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp (+3)
  • (modified) libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp (+3)
  • (modified) libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp (+3)
  • (modified) libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp (+3)
  • (modified) libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.format.pass.cpp (+4)
  • (modified) libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.vformat.pass.cpp (+4)
  • (modified) libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp (+3)
  • (modified) libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp (+4)
  • (modified) libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp (+3)
  • (modified) libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp (+4)
  • (modified) libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp (+4)
  • (modified) libcxx/test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp (+4)
  • (modified) libcxx/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp (+3)
  • (modified) libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.format.pass.cpp (+4)
  • (modified) libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.vformat.pass.cpp (+4)
  • (modified) libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.format.pass.cpp (+4)
  • (modified) libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.vformat.pass.cpp (+4)
  • (modified) libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.format.pass.cpp (+4)
  • (modified) libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.vformat.pass.cpp (+4)
  • (modified) libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.pass.cpp (+4)
  • (modified) libcxx/test/std/utilities/format/format.range/format.range.fmtstr/parse.pass.cpp (+4)
  • (modified) libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.format.pass.cpp (+4)
  • (modified) libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.vformat.pass.cpp (+4)
  • (added) libcxx/utils/ci/build-wasi-libc.sh (+106)
  • (added) libcxx/utils/ci/install-wasmkit.sh (+64)
  • (modified) libcxx/utils/ci/run-buildbot (+78)
  • (modified) libcxx/utils/libcxx/test/features/platform.py (+4)
  • (added) libcxx/utils/wasm.py (+54)
  • (modified) libcxxabi/src/cxa_personality.cpp (+3)
  • (modified) libcxxabi/test/backtrace_test.pass.cpp (+3)
  • (added) libcxxabi/test/configs/wasm32-wasip1-libc++abi.cfg.in (+41)
  • (modified) libcxxabi/test/cxa_call_terminate.pass.cpp (+5)
  • (modified) libcxxabi/test/forced_unwind1.pass.cpp (+3)
  • (modified) libcxxabi/test/forced_unwind2.pass.cpp (+3)
  • (modified) libcxxabi/test/test_vector3.pass.cpp (+5)
  • (modified) libunwind/src/config.h (+1-1)
diff --git a/libcxx/cmake/caches/WASI.cmake b/libcxx/cmake/caches/WASI.cmake
new file mode 100644
index 0000000000000..fd7e6a14aad67
--- /dev/null
+++ b/libcxx/cmake/caches/WASI.cmake
@@ -0,0 +1,53 @@
+set(CMAKE_ASM_COMPILER_TARGET "wasm32-wasip1" CACHE STRING "")
+set(CMAKE_CXX_COMPILER_TARGET "wasm32-wasip1" CACHE STRING "")
+set(CMAKE_C_COMPILER_TARGET "wasm32-wasip1" CACHE STRING "")
+set(CMAKE_SYSTEM_NAME Generic CACHE STRING "")
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY CACHE STRING "")
+
+set(COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL "")
+set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
+set(COMPILER_RT_DEFAULT_TARGET_ONLY ON CACHE BOOL "")
+
+set(LIBCXX_ENABLE_EXCEPTIONS ON CACHE BOOL "")
+set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
+# The locale base API has no WASI backend, so it falls back to the IBM one.
+set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
+set(LIBCXX_ENABLE_RTTI ON CACHE BOOL "")
+set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
+set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
+set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "")
+# Long tests are prohibitively slow when run under a WebAssembly interpreter.
+set(LIBCXX_TEST_PARAMS "long_tests=False" CACHE STRING "")
+set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+
+set(LIBCXXABI_BAREMETAL ON CACHE BOOL "")
+set(LIBCXXABI_ENABLE_EXCEPTIONS ON CACHE BOOL "")
+set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_STATIC ON CACHE BOOL "")
+set(LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
+set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
+set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
+set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
+
+set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBUNWIND_ENABLE_STATIC ON CACHE BOOL "")
+set(LIBUNWIND_ENABLE_THREADS OFF CACHE BOOL "")
+set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
+
+find_program(WASI_RUNTIME wasmkit REQUIRED)
+
+# On embedded platforms that don't support shared library targets, CMake implicitly changes shared
+# library targets to be static library targets. This results in duplicate definitions of the static
+# library targets even though we might not ever build the shared library target, which breaks the
+# build. To work around this, we change the output name of the  shared library target so that it
+# can't conflict with the static library target.
+#
+# This is tracked by https://gitlab.kitware.com/cmake/cmake/-/issues/25759.
+set(LIBCXX_SHARED_OUTPUT_NAME "c++-shared" CACHE STRING "")
+set(LIBCXXABI_SHARED_OUTPUT_NAME "c++abi-shared" CACHE STRING "")
+set(LIBUNWIND_SHARED_OUTPUT_NAME "unwind-shared" CACHE STRING "")
diff --git a/libcxx/test/configs/wasm32-wasip1-libc++.cfg.in b/libcxx/test/configs/wasm32-wasip1-libc++.cfg.in
new file mode 100644
index 0000000000000..3919ca84fa015
--- /dev/null
+++ b/libcxx/test/configs/wasm32-wasip1-libc++.cfg.in
@@ -0,0 +1,39 @@
+config.substitutions.append(('%{flags}', '--sysroot=@CMAKE_INSTALL_PREFIX@ @WASI_EH_FLAGS@'))
+
+config.substitutions.append(('%{compile_flags}',
+    '-nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support'
+
+    # wasi-libc gates signals, process clocks and setjmp/longjmp behind these, and
+    # the runtime implements only the standardized exception handling encoding.
+    ' -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_PROCESS_CLOCKS'
+    ' -mllvm -wasm-enable-sjlj -mllvm -wasm-use-legacy-eh=false'
+))
+config.substitutions.append(('%{link_flags}',
+    # wasi-libc keeps long double formatting out of libc to save size, so the
+    # archive providing it has to override libc's stubs.
+    '-nodefaultlibs -L %{lib-dir} -lc++ -lc++abi -lc-printscan-long-double'
+    ' -lc -lwasi-emulated-signal -lwasi-emulated-process-clocks -lsetjmp'
+    ' -lclang_rt.builtins'
+
+    # wasm-ld defaults the stack to 64 KiB, far below what tests holding large
+    # objects on it need. Match the 8 MiB a hosted main thread gets.
+    ' -Wl,-z,stack-size=0x800000'
+))
+
+config.executor = (
+    '@LIBCXX_SOURCE_DIR@/utils/wasm.py'
+    ' --runtime @WASI_RUNTIME@')
+config.substitutions.append(('%{exec}',
+    '%{executor}'
+    ' --execdir %{temp}'
+))
+
+import os, site
+site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
+import libcxx.test.params, libcxx.test.config
+libcxx.test.config.configure(
+    libcxx.test.params.DEFAULT_PARAMETERS,
+    libcxx.test.features.DEFAULT_FEATURES,
+    config,
+    lit_config
+)
diff --git a/libcxx/test/extensions/clang/clang_modules_include.gen.py b/libcxx/test/extensions/clang/clang_modules_include.gen.py
index ed058cd908511..fc69fe21edff4 100644
--- a/libcxx/test/extensions/clang/clang_modules_include.gen.py
+++ b/libcxx/test/extensions/clang/clang_modules_include.gen.py
@@ -30,6 +30,9 @@
 # TODO: Investigate why this doesn't work on Picolibc once the locale base API is refactored
 # UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
 
+# TODO: Fix the <wchar.h> redefinitions on WASI
+# UNSUPPORTED: LIBCXX-WASI-FIXME
+
 # TODO: Fix seemingly circular inclusion or <wchar.h> on AIX
 # UNSUPPORTED: LIBCXX-AIX-FIXME
 
diff --git a/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp b/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp
index 0cc4b1e005226..5a08be6821ce3 100644
--- a/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp
+++ b/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp
@@ -6,6 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+// The test needs a SIGABRT handler to run, which WASI does not deliver.
+// XFAIL: LIBCXX-WASI-FIXME
+
 // Test that the default verbose termination function aborts the program.
 // XFAIL: availability-verbose_abort-missing
 
diff --git a/libcxx/test/libcxx/containers/associative/map/at.abort.pass.cpp b/libcxx/test/libcxx/containers/associative/map/at.abort.pass.cpp
index fae3370805dd3..6d438e6de639b 100644
--- a/libcxx/test/libcxx/containers/associative/map/at.abort.pass.cpp
+++ b/libcxx/test/libcxx/containers/associative/map/at.abort.pass.cpp
@@ -6,6 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+// The test needs a SIGABRT handler to run, which WASI does not deliver.
+// XFAIL: LIBCXX-WASI-FIXME
+
 // <map>
 
 // class map
diff --git a/libcxx/test/libcxx/containers/associative/map/at.const.abort.pass.cpp b/libcxx/test/libcxx/containers/associative/map/at.const.abort.pass.cpp
index d50faeff79496..d160c9acd3d3d 100644
--- a/libcxx/test/libcxx/containers/associative/map/at.const.abort.pass.cpp
+++ b/libcxx/test/libcxx/containers/associative/map/at.const.abort.pass.cpp
@@ -6,6 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+// The test needs a SIGABRT handler to run, which WASI does not deliver.
+// XFAIL: LIBCXX-WASI-FIXME
+
 // <map>
 
 // class map
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp
index 58771ace284b7..6cc1c62cff854 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp
@@ -6,6 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+// The test needs a SIGABRT handler to run, which WASI does not deliver.
+// XFAIL: LIBCXX-WASI-FIXME
+
 // <unordered_map>
 
 // class unordered_map
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp
index b185f837dce7f..201a341d2da8a 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp
@@ -6,6 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+// The test needs a SIGABRT handler to run, which WASI does not deliver.
+// XFAIL: LIBCXX-WASI-FIXME
+
 // <unordered_map>
 
 // class unordered_map
diff --git a/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp b/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp
index 0b1a434ee45b5..f6485836d9294 100644
--- a/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp
+++ b/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp
@@ -6,6 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+// On wasm, structs are returned through a pointer to the caller's storage.
+// XFAIL: LIBCXX-WASI-FIXME
+
 // <memory>
 
 // Test weak_ptr<T> with trivial_abi as return-type.
diff --git a/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp
index 11bd1a5928d4a..982db52d6dc78 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp
@@ -6,6 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+// The test has no expected max_size for wasm.
+// UNSUPPORTED: LIBCXX-WASI-FIXME
+
 // <string>
 
 // This test ensures that the correct max_size() is returned depending on the platform.
diff --git a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.format.pass.cpp b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.format.pass.cpp
index 6d2a5ecbb5ecf..54a42127ddec0 100644
--- a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.format.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.format.pass.cpp
@@ -6,6 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc does not provide mkstemp, which the test support header uses to
+// create temporary files.
+// UNSUPPORTED: LIBCXX-WASI-FIXME
+
 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
diff --git a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.vformat.pass.cpp b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.vformat.pass.cpp
index c6f1815de9c57..9e00971782d8c 100644
--- a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.vformat.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.vformat.pass.cpp
@@ -6,6 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc does not provide mkstemp, which the test support header uses to
+// create temporary files.
+// UNSUPPORTED: LIBCXX-WASI-FIXME
+
 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
diff --git a/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp
index 289a3d1e5c63d..96d857fca9180 100644
--- a/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp
@@ -6,6 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc does not define the floating point environment macros.
+// UNSUPPORTED: LIBCXX-WASI-FIXME
+
 // Picolibc does not define some of the floating point environment macros for
 // arm platforms without hardware floating point support.
 // UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
diff --git a/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp
index 080efcd4fb3e3..095fff8056307 100644
--- a/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp
@@ -6,6 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc defines WINT_MIN and WINT_MAX as unsigned, while the compiler
+// makes wint_t signed for wasm.
+// XFAIL: LIBCXX-WASI-FIXME
+
 // test <stdint.h>
 
 #include <stdint.h>
diff --git a/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp
index 369e40f0d5fd2..00a41e46a6cd6 100644
--- a/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp
@@ -6,6 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc does not define L_tmpnam or TMP_MAX, and has no tmpfile.
+// UNSUPPORTED: LIBCXX-WASI-FIXME
+
 // Missing some functions/macros.
 // XFAIL: LLVM-LIBC-FIXME
 
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
index 513af522a6582..27becb18e464a 100644
--- a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
@@ -6,6 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc's strerror returns a message for unknown errors that this test
+// does not accept.
+// XFAIL: LIBCXX-WASI-FIXME
+
 // <system_error>
 
 // class error_category
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
index 055422b2bab3a..fc302fe5c1bd9 100644
--- a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
@@ -6,6 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc's strerror returns a message for unknown errors that this test
+// does not accept.
+// XFAIL: LIBCXX-WASI-FIXME
+
 // Investigate why we get an assertion failure with LLVM libc.
 // XFAIL: LLVM-LIBC-FIXME
 
diff --git a/libcxx/test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp b/libcxx/test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp
index 682c3829fceae..85bf7f4338bc4 100644
--- a/libcxx/test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp
+++ b/libcxx/test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp
@@ -6,6 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc defines WINT_MIN and WINT_MAX as unsigned, while the compiler
+// makes wint_t signed for wasm.
+// XFAIL: LIBCXX-WASI-FIXME
+
 // test <cstdint>
 
 #include <cstdint>
diff --git a/libcxx/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp b/libcxx/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp
index e6244c745549c..1e4401956c228 100644
--- a/libcxx/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp
+++ b/libcxx/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp
@@ -6,6 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc does not define the floating point environment macros.
+// UNSUPPORTED: LIBCXX-WASI-FIXME
+
 // Picolibc does not define some of the floating point environment macros for
 // arm platforms without hardware floating point support.
 // UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.format.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.format.pass.cpp
index d64e9a6dc2a8a..98641e1a4fae8 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.format.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.format.pass.cpp
@@ -6,6 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc does not provide mkstemp, which the test support header uses to
+// create temporary files.
+// UNSUPPORTED: LIBCXX-WASI-FIXME
+
 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.vformat.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.vformat.pass.cpp
index 93745cfbbdaaf..e6f2a72117734 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.vformat.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.vformat.pass.cpp
@@ -6,6 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc does not provide mkstemp, which the test support header uses to
+// create temporary files.
+// UNSUPPORTED: LIBCXX-WASI-FIXME
+
 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.format.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.format.pass.cpp
index 98097cfbda9e1..3fc7f8913e077 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.format.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.format.pass.cpp
@@ -6,6 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc does not provide mkstemp, which the test support header uses to
+// create temporary files.
+// UNSUPPORTED: LIBCXX-WASI-FIXME
+
 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.vformat.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.vformat.pass.cpp
index 6afae316b2003..03eb43178839f 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.vformat.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.vformat.pass.cpp
@@ -6,6 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc does not provide mkstemp, which the test support header uses to
+// create temporary files.
+// UNSUPPORTED: LIBCXX-WASI-FIXME
+
 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.format.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.format.pass.cpp
index 5fc9f94f03ac0..a0bf4647ba04d 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.format.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.format.pass.cpp
@@ -6,6 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// wasi-libc does not provide mkstemp, which the test support header uses to
+// create temporary files.
+// UNSUPPORTED: LIBCXX-WASI-FIXME
+
 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.vformat.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.vformat.pass.cpp
index 2328a72d2f91e..931f63242632a 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.vformat.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.vformat.pass.cpp
@@ -6,6 +6,10 @@
 //
 //===-----------------------------------------...
[truncated]

@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

✅ With the latest revision this PR passed the Python code formatter.

@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

✅ With the latest revision this PR passed the C/C++ code formatter.

@philnik777 philnik777 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear, the intention of the various -FIXME features is that they are eventually removed. A few of the comments seem to imply that there is no intention of supporting the feature. If that's the case, the tests should be disabled via target= instead of the -FIXME feature. The tests can of course also be modified to test the specific behaviour of wasm if feasible, and in those cases the -FIXME should be used.

Looks like we need to update the CMake version in the docker image to allow building the wasi-libc. I'll open a patch, since we need to do that anyways.

Comment on lines +723 to +725
#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__)
(void)lpStart; // When using SjLj/Wasm exceptions, lpStart is never used
#endif

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just slap a [[maybe_unused]] on lpStart.

Comment thread libunwind/src/config.h
// The CMake file passes -fvisibility=hidden to control ELF/Mach-O visibility.
#define _LIBUNWIND_EXPORT
#define _LIBUNWIND_HIDDEN
#elif !defined(__ELF__) && !defined(__MACH__) && !defined(_AIX) && \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it should really just be defined(_WIN32).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not attached: Please update libcxx/util/ci/BOT_OWNERS.txt so we know who to ask if something goes wrong. Also, feel free to add WASI to the list of supported platforms in libcxx/docs/index.rst.

@ldionne ldionne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice. Let's update the CMake in the Docker image to unblock this and see what's failing in the CI. I assume this was passing locally?

About how long does it take to run the full test suite under the emulator?


set(LIBCXX_ENABLE_EXCEPTIONS ON CACHE BOOL "")
set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
# The locale base API has no WASI backend, so it falls back to the IBM one.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we should use the no-locale backend for WASI in this patch instead. Look at what Fuchsia is doing in libcxx/include/__locale_dir/support/fuchsia.h, we should be able to do something similar?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github:workflow libc++abi libc++abi C++ Runtime Library. Not libc++. libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. libunwind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants