Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
5498029
Big ugly WIP
bvisness Sep 30, 2026
522af17
time.h
bvisness Sep 30, 2026
cc8c7c3
Try to bind performance.now() in anticipation of monotonic clocks
bvisness Sep 30, 2026
518ba9a
Well, wit-bindgen is 1% happier
bvisness Oct 3, 2026
13fd474
Lots of time fixes + web-specific error reporting?
bvisness Oct 3, 2026
1031ca3
Don't include translate_error in webp2
bvisness Oct 3, 2026
a5661ed
Organize libc-bottom-half sources by category
bvisness Oct 3, 2026
4f5370f
Random implementation (disaster)
bvisness Oct 3, 2026
648d442
Always trap on exit
bvisness Oct 3, 2026
4027b90
Main ramblings
bvisness Oct 4, 2026
7f2fa0f
Empty environment for web
bvisness Oct 4, 2026
24fe702
Use many randomness hooray
bvisness Oct 4, 2026
1cecdc1
Actually build enough to get linker errors!!
bvisness Oct 4, 2026
7b6bc3a
Slog through many linker errors
bvisness Oct 4, 2026
e4e27cf
Exit 0!!!
bvisness Oct 4, 2026
6911219
Set -fvisibiliyt-hidden on webp2.c
bvisness Oct 5, 2026
8bdaabd
Hopefully fix CI errors
bvisness Oct 5, 2026
31dff18
Ensure trapping stubs for weakly aliased things we excluded
bvisness Oct 6, 2026
ef154ba
Exclude some headers and add some stubs
bvisness Oct 6, 2026
42ad0d9
Stub remaining header symbols
bvisness Oct 6, 2026
edfdcd5
Run update-symbols for webp2
bvisness Oct 6, 2026
92117be
Fix formatting, run more webp2 stuff in CI
bvisness Oct 6, 2026
ff9460e
Shrink initial __wasilibc_random allocation
bvisness Oct 6, 2026
dd3e50c
Properly stub sleep functions
bvisness Oct 6, 2026
89b9661
Remove unnecessary webp2 guards from sources that are no longer compiled
bvisness Oct 6, 2026
115eed7
Suppress unnecessary wasi headers
bvisness Oct 6, 2026
df8719f
Merge remote-tracking branch 'origin/main' into webp2
bvisness Oct 6, 2026
cabca69
Update expected files
bvisness Oct 6, 2026
28cbcb5
Better regex for a target triple
bvisness Oct 6, 2026
39664f1
Change what gets the external-id in WIT
bvisness Oct 7, 2026
96e1c0e
Fix formatting and expected symbols
bvisness Oct 7, 2026
6b78b5c
Support new WEB system name
bvisness Oct 8, 2026
2a623e6
Bump wasm-component-ld version for accessor support
bvisness Oct 8, 2026
2969570
Hook main into _initialize for webp2
bvisness Oct 8, 2026
4cb0ed1
Import web things from wasm:js/global interface
bvisness Oct 9, 2026
8825299
Use newer wasm-tools in tests
bvisness Oct 9, 2026
f6ef789
WIP stdio
bvisness Oct 9, 2026
13a3808
Move the console's external-id to the import
bvisness Oct 9, 2026
c9dd7b6
Fix stdio bugs
bvisness Oct 10, 2026
aa1ecfd
Only emit valid UTF-8 on stdout/stderr
bvisness Oct 11, 2026
57d1b31
Implement remaining stdio-friendly stubs
bvisness Oct 12, 2026
8a2d6e3
Flush stdout/stderr on exit
bvisness Oct 12, 2026
67c1bc1
Simplify stdio flushing logic
bvisness Oct 12, 2026
13cde4c
Update expected symbols
bvisness Oct 12, 2026
4a5ec8a
Remove spurious comment
bvisness Oct 12, 2026
266d97d
Provide argv[0] like Emscripten
bvisness Oct 12, 2026
19063d3
Use console.warn for stderr
bvisness Oct 12, 2026
423d7e8
Flush musl's buffers on exit / flush out buffers on fflush
bvisness Oct 13, 2026
e53aca3
Always print a message on exit()
bvisness Oct 13, 2026
3cc738a
Refactor UTF-8 code, sanitize all error output
bvisness Oct 13, 2026
b8a3b60
Close stdio file descriptors when shutting down
bvisness Oct 13, 2026
310c46d
clang-format!!!!
bvisness Oct 13, 2026
a724b40
Hide a few new symbols
bvisness Oct 13, 2026
45a8110
Implement a few more fd syscalls for stdio
bvisness Oct 13, 2026
a11e8b7
Add absurd(ly good?!) test framework
bvisness Oct 14, 2026
9a6ba1a
Switch back from reactor to command for webp2
bvisness Oct 14, 2026
3cd9c7f
Enable tests in CI
bvisness Oct 14, 2026
4463728
Update wit-bindgen dep
alexcrichton Oct 14, 2026
3f73796
Try to fix tests
alexcrichton Oct 14, 2026
b9d2628
Update generated bindings
alexcrichton Oct 14, 2026
a72f66e
Update defined symbols
alexcrichton Oct 14, 2026
1b2c3cf
Stop installing specific dev version of wit-bindgen in CI
bvisness Oct 15, 2026
d3360b4
Start QUIRKS.md
bvisness Oct 15, 2026
bc419ab
Spread contents of webp2_file_descriptors.c back out
bvisness Oct 15, 2026
29c74ce
Add tests for dupery
bvisness Oct 15, 2026
e1478ee
Redo stdio implementation to use the descriptor table
bvisness Oct 15, 2026
0ef9186
Actually enable dup
bvisness Oct 15, 2026
69ff2f2
Shut up unused function warning
bvisness Oct 15, 2026
66cedbf
Update expected symbols
bvisness Oct 15, 2026
3eb5946
Update clock_getres.c
bvisness Oct 15, 2026
435da9b
Spread stubs out across the whole program
bvisness Oct 15, 2026
a8909ce
Format files
bvisness Oct 15, 2026
bfa11cb
Fix symbols again probably
bvisness Oct 15, 2026
64fa30f
Move UTF-8 code closer together
bvisness Oct 15, 2026
9b08f31
Just log unsupported functions and return errors
bvisness Oct 19, 2026
03cf4a8
Use the descriptor table for socket things
bvisness Oct 19, 2026
e5e55b0
Fix header error, fix symbol lists
bvisness Oct 19, 2026
c1819a3
Fold report-errorf.h into report-error.h
bvisness Oct 20, 2026
e0cc4bf
Remove lots of webp2-specific code
bvisness Oct 22, 2026
2de4feb
Add unsupported logs to posix.c functions
bvisness Oct 22, 2026
7796415
Restore original readv/writev implementations
bvisness Oct 22, 2026
d37b135
Update symbols
bvisness Oct 22, 2026
338a4f3
Fix formatting / misc. feedback
bvisness Oct 22, 2026
28063b9
Merge remote-tracking branch 'origin/main' into webp2
bvisness Oct 22, 2026
51b4cf5
Fix mistakes from merge
bvisness Oct 22, 2026
d09715a
Keep older version of wasmtime by default
bvisness Oct 22, 2026
0f4c179
Add missing include guard
bvisness Oct 23, 2026
b132276
Don't use generated header directly
bvisness Oct 23, 2026
6b41b44
Dispatch fflush through the descriptor vtable
bvisness Oct 23, 2026
f3247af
Clean up crt1-command.c
bvisness Oct 23, 2026
e978657
Add extra comments for report_errorf
bvisness Oct 23, 2026
20a2b9e
Use size_t in utf-8 writer
bvisness Oct 23, 2026
fe6dfe2
Report precise nonzero status code on exit
bvisness Nov 9, 2026
7d703f6
Assume wasi-sdk C compiler for tests
bvisness Nov 9, 2026
835a19c
Merge remote-tracking branch 'origin/main' into webp2
bvisness Nov 9, 2026
35f42b9
Include pipe tests in build but suppress at runtime
bvisness Nov 9, 2026
9938744
Change which wasm-component-ld is used for the web adapter
bvisness Nov 9, 2026
47f9a94
Fix symbols
bvisness Nov 9, 2026
bc9886e
Make stdout and stderr ttys
bvisness Nov 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ expected linguist-generated
# Flag some wit-bindgen-generated files checked into the repo as generated
__generated_wasip2.h linguist-generated
__generated_wasip3.h linguist-generated
__generated_webp2.h linguist-generated
libc-bottom-half/sources/wasip2.c linguist-generated
libc-bottom-half/sources/wasip3.c linguist-generated
libc-bottom-half/sources/webp2.c linguist-generated
10 changes: 10 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ jobs:
test: true
args: -DCMAKE_BUILD_TYPE=Debug -DTARGET_TRIPLE=wasm32-wasip3 -DENABLE_COOP_THREADS=ON

- name: Test wasm32-webp2
os: ubuntu-24.04
# wasi-sdk is required to build the wasip2 web adapter for tests.
clang_version: wasi-sdk-34.0-rc.3
upload: wasm32-webp2
test: true
args: -DTARGET_TRIPLE=wasm32-webp2

- name: Test emmalloc
os: ubuntu-26.04
clang_version: 20
Expand Down Expand Up @@ -259,6 +267,8 @@ jobs:
- run: ninja -C build format-check
- run: cmake -S . -B build -DTARGET_TRIPLE=wasm32-wasip3
- run: ninja -C build format-check
- run: cmake -S . -B build -DTARGET_TRIPLE=wasm32-webp2
- run: ninja -C build format-check

rustfmt:
name: Rustfmt
Expand Down
39 changes: 32 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,17 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type to use" FORCE)
endif()

# Force a cross-compile to WASI at all times.
set(CMAKE_SYSTEM_NAME WASI)
set(TARGET_TRIPLE "wasm32-wasip1" CACHE STRING "WASI target to test")
set(CMAKE_C_COMPILER_TARGET ${TARGET_TRIPLE})

# Force a cross-compile to WASI or WEB at all times.
if(TARGET_TRIPLE MATCHES "-wasi")
set(CMAKE_SYSTEM_NAME WASI)
elseif(TARGET_TRIPLE MATCHES "-web")
set(CMAKE_SYSTEM_NAME WEB)
else()
message(FATAL_ERROR "Unknown target triple: ${TARGET_TRIPLE}")
endif()

# I'm not entirely sure why this is necessary on Windows. This may be a bug in
# CMake, I'm not sure. The problem is that, at least on CI, CMake detects that
Expand All @@ -26,9 +35,6 @@ if (CMAKE_HOST_WIN32)
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
endif()

set(TARGET_TRIPLE "wasm32-wasip1" CACHE STRING "WASI target to test")
set(CMAKE_C_COMPILER_TARGET ${TARGET_TRIPLE})

# We're building libc, and the compiler being used may not have a wasm sysroot
# for libc, so skip this check. Otherwise the `project` call below attempts a
# link to see if the compiler is working and if that fails it doesn't mean it
Expand Down Expand Up @@ -60,6 +66,7 @@ option(CHECK_SYMBOLS "Whether or not to check the exported symbols of libc.a" OF
set(WASI_SDK_VERSION "" CACHE STRING "Version information for wasi-sdk to embed in headers")
option(ENABLE_WERROR "Whether to compile with `-Werror`" OFF)
option(ENABLE_COOP_THREADS "Whether to compile with cooperative threads support" OFF)
option(LOG_UNSUPPORTED_CALLS "Whether to log error messages when calling unsupported APIs" OFF)

if(TARGET_TRIPLE MATCHES "-threads$")
set(WASI p1)
Expand All @@ -79,8 +86,11 @@ elseif(TARGET_TRIPLE MATCHES "-wasip2$")
elseif(TARGET_TRIPLE MATCHES "-wasip3$")
set(WASI p3)
set(SHARED ON)
elseif(TARGET_TRIPLE MATCHES "-webp2$")
set(WEB p2)
set(SHARED ON)
else()
message(FATAL_ERROR "Unknown WASI target triple: ${TARGET_TRIPLE}")
message(FATAL_ERROR "Unknown target triple: ${TARGET_TRIPLE}")
endif()

if(BUILD_SHARED)
Expand Down Expand Up @@ -143,18 +153,25 @@ if(SIMD)
-D__wasilibc_simd_string)
endif()

if(LOG_UNSUPPORTED_CALLS)
add_compile_definitions(WASILIBC_LOG_UNSUPPORTED_CALLS)
endif()

if(WASI STREQUAL "p1")
set(__wasip1__ ON)
elseif(WASI STREQUAL "p2")
set(__wasip2__ ON)
elseif(WASI STREQUAL "p3")
set(__wasip3__ ON)
elseif(WEB STREQUAL "p2")
set(__webp2__ ON)
else()
message(FATAL_ERROR "Unknown WASI version: ${WASI}")
endif()

set(wasip2-version 0.2.12)
set(wasip3-version 0.3.2)
set(webp2-version 0.2.0)

# =============================================================================
# Detection of a libcall thread context for wasip3
Expand Down Expand Up @@ -204,6 +221,12 @@ add_link_options(
-resource-dir ${tmp_resource_dir}
)

if(__webp2__)
# TODO(webp2): Manually instruct clang to look at our new webp2 sysroot until
# it has been patched in wasi-sdk to know about "webp2" as an OS.
add_link_options(-B${SYSROOT_LIB} -L${SYSROOT_LIB})
endif()

# Expose the public headers to the implementation. We use `-isystem` for
# purpose for two reasons:
#
Expand Down Expand Up @@ -251,7 +274,7 @@ check_c_compiler_flag(-fdefer-ts HAVE_FDEFER_TS)
if(HAVE_FDEFER_TS)
add_compile_options(-fdefer-ts)
elseif(NOT WASI STREQUAL "p1")
message(FATAL_ERROR "wasip2/wasip3 require clang 22 or later for `-fdefer-ts`")
message(FATAL_ERROR "wasip2/wasip3/webp2 require clang 22 or later for `-fdefer-ts`")
endif()

# =============================================================================
Expand Down Expand Up @@ -372,6 +395,8 @@ if (WASI STREQUAL "p2")
set(libc_extra_objects libc-bottom-half/sources/wasip2_component_type.o)
elseif (WASI STREQUAL "p3")
set(libc_extra_objects libc-bottom-half/sources/wasip3_component_type.o)
elseif (WEB STREQUAL "p2")
set(libc_extra_objects libc-bottom-half/sources/webp2_component_type.o)
endif()

add_library(c SHARED EXCLUDE_FROM_ALL
Expand Down
19 changes: 19 additions & 0 deletions QUIRKS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
This is a list of toolchain-specific quirks, to be migrated to better user-facing documentation in the future.

## Web Preview 2 (webp2)

- Some libc functionality is not implemented and will trap if called:
- Files and file descriptors (with exceptions to support stdio below)
- Sockets
- Sleeping
- `stdout` and `stderr` are mapped to `console.log` and `console.warn` respectively:
- Output is expected to be UTF-8. Invalid UTF-8 will be replaced with U+FFFD (�).
- Console output is buffered until a newline is reached. `fflush` can be used to trigger a `console.log` or `console.warn` at any time, regardless of newlines.
- `stdin` is readable but will always EOF.
- `environ` is always empty.
- All calls to `exit` will trap, including `exit(0)`.
- This is because there is currently no way to abort execution of a WebAssembly program without trapping.
- The `main` function has additional restrictions:
- `argc` is always 1, and `argv` is always `{"./this.program"}`.
- In order for exported functions to remain callable after `main`, no destructors are run when `main` finishes.
- If `main` returns a non-zero value, the program will trap, analogous to `exit`.
1 change: 1 addition & 0 deletions cmake/Platform/WEB.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set(WEB 1)
81 changes: 49 additions & 32 deletions cmake/bindings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ if(WIT_BINDGEN_EXECUTABLE)
OUTPUT_VARIABLE WIT_BINDGEN_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)

if (NOT (WIT_BINDGEN_VERSION MATCHES "0\\.60\\.0"))
message(WARNING "wit-bindgen version 0.60.0 is required, found: ${WIT_BINDGEN_VERSION}")
if (NOT (WIT_BINDGEN_VERSION MATCHES "0\\.63\\.0"))
message(WARNING "wit-bindgen version 0.63.0 is required, found: ${WIT_BINDGEN_VERSION}")
set(WIT_BINDGEN_EXECUTABLE "")
endif()
endif()
Expand All @@ -26,7 +26,7 @@ if (NOT WIT_BINDGEN_EXECUTABLE)
ba_download(
wit-bindgen
"https://github.com/bytecodealliance/wit-bindgen"
"0.60.0"
"0.63.0"
)
ExternalProject_Get_Property(wit-bindgen SOURCE_DIR)
set(wit_bindgen "${SOURCE_DIR}/wit-bindgen")
Expand All @@ -38,7 +38,7 @@ endif()
set(bottom_half "${CMAKE_SOURCE_DIR}/libc-bottom-half")

add_custom_target(
bindings-p2
bindings-wasip2
COMMAND
${wit_bindgen} c
--autodrop-borrows yes
Expand Down Expand Up @@ -80,7 +80,7 @@ add_custom_target(
)

add_custom_target(
bindings-p3
bindings-wasip3
COMMAND
${wit_bindgen} c
--autodrop-borrows yes
Expand Down Expand Up @@ -110,35 +110,51 @@ add_custom_target(

# Disable async bindings generation for some functions which are only
# ever called synchronously within libc.
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.metadata-hash"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.metadata-hash-at"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.stat"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.stat-at"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.get-flags"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.open-at"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.read-directory"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.create-directory-at"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.remove-directory-at"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.unlink-file-at"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.advise"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.sync-data"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.sync"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.set-size"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.symlink-at"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.link-at"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.readlink-at"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.rename-at"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.set-times-at"
"--async=-wasi:filesystem/types@${wasip3-version}#[method]descriptor.set-times"
"--async=-wasi:sockets/ip-name-lookup@${wasip3-version}#resolve-addresses"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.metadata-hash"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.metadata-hash-at"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.stat"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.stat-at"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.get-flags"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.open-at"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.read-directory"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.create-directory-at"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.remove-directory-at"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.unlink-file-at"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.advise"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.sync-data"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.sync"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.set-size"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.symlink-at"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.link-at"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.readlink-at"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.rename-at"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.set-times-at"
"--sync=wasi:filesystem/types@${wasip3-version}#[method]descriptor.set-times"
"--sync=wasi:sockets/ip-name-lookup@${wasip3-version}#resolve-addresses"
${CMAKE_SOURCE_DIR}/wasi/p3/wit
COMMAND cmake -E copy wasip3.h ${bottom_half}/headers/public/wasi/__generated_wasip3.h
COMMAND cmake -E copy wasip3_component_type.o ${bottom_half}/sources
COMMAND cmake -E copy wasip3.c ${bottom_half}/sources
DEPENDS wit-bindgen wasip3-wits
)

add_custom_target(bindings DEPENDS bindings-p2 bindings-p3)
add_custom_target(
bindings-webp2
COMMAND
${wit_bindgen} c
--autodrop-borrows yes
--rename wasm:js/global=webp2
--rename wasm:js/console=webp2_console
--rename-world webp2
--type-section-suffix __wasi_libc
${CMAKE_SOURCE_DIR}/web/p2/wit
COMMAND cmake -E copy webp2.h ${bottom_half}/headers/public/wasi/__generated_webp2.h
COMMAND cmake -E copy webp2_component_type.o ${bottom_half}/sources
COMMAND cmake -E copy webp2.c ${bottom_half}/sources
DEPENDS wit-bindgen
)

add_custom_target(bindings DEPENDS bindings-wasip2 bindings-wasip3 bindings-webp2)

if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set(SED_INPLACE_ARGS -i '')
Expand All @@ -149,13 +165,14 @@ endif()
function(wit_bindgen_edit p)
add_custom_target(
bindings-${p}-edit
COMMAND sed ${SED_INPLACE_ARGS} "'s_#include .wasi${p}\.h._#include \"wasi/wasi${p}.h\"_'" ${bottom_half}/sources/wasi${p}.c
COMMAND sed ${SED_INPLACE_ARGS} "s/extern void exit_exit/_Noreturn extern void exit_exit/" ${bottom_half}/headers/public/wasi/__generated_wasi${p}.h
COMMAND sed ${SED_INPLACE_ARGS} "s/extern void __wasm_import_exit_exit/_Noreturn extern void __wasm_import_exit_exit/" ${bottom_half}/sources/wasi${p}.c
COMMAND sed ${SED_INPLACE_ARGS} "'s_#include .${p}\.h._#include \"wasi/${p}.h\"_'" ${bottom_half}/sources/${p}.c
COMMAND sed ${SED_INPLACE_ARGS} "s/extern void exit_exit/_Noreturn extern void exit_exit/" ${bottom_half}/headers/public/wasi/__generated_${p}.h
COMMAND sed ${SED_INPLACE_ARGS} "s/extern void __wasm_import_exit_exit/_Noreturn extern void __wasm_import_exit_exit/" ${bottom_half}/sources/${p}.c
DEPENDS bindings-${p}
)
add_dependencies(bindings bindings-${p}-edit)
endfunction()

wit_bindgen_edit(p2)
wit_bindgen_edit(p3)
wit_bindgen_edit(wasip2)
wit_bindgen_edit(wasip3)
wit_bindgen_edit(webp2)
2 changes: 2 additions & 0 deletions cmake/check-symbols.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ elseif(WASI STREQUAL "p3")
else()
set(expected "${CMAKE_SOURCE_DIR}/expected/wasm32-wasip3")
endif()
elseif(WEB STREQUAL "p2")
set(expected "${CMAKE_SOURCE_DIR}/expected/wasm32-webp2")
else()
message(FATAL_ERROR "Unknown WASI version: ${WASI}")
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/clang-format.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set(formatted_sources)

function(clang_format_file file)
if (file MATCHES "__generated" OR
file MATCHES "wasip.\.c$" OR # Skip auto-generated files
file MATCHES "(wasip.|webp2)\.c$" OR # Skip auto-generated files
file MATCHES "\.(s|S)$") # Skip assembly files
return()
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/wasm-component-ld.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if (NOT USE_WASM_COMPONENT_LD)
return()
endif()

set(WASM_COMPONENT_LD_REQUIRED_VERSION "0.5.30")
set(WASM_COMPONENT_LD_REQUIRED_VERSION "0.5.31")

find_program(WASM_COMPONENT_LD_EXECUTABLE NAMES wasm-component-ld)

Expand Down
2 changes: 1 addition & 1 deletion cmake/wasm-tools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if (NOT WASM_TOOLS_EXECUTABLE)
ba_download(
wasm-tools
"https://github.com/bytecodealliance/wasm-tools"
"1.257.0"
"1.261.0"
)
ExternalProject_Get_Property(wasm-tools SOURCE_DIR)
set(wasm_tools "${SOURCE_DIR}/wasm-tools")
Expand Down
6 changes: 6 additions & 0 deletions expected/wasm32-wasip1-threads/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,19 @@ __wasilibc_pthread_self
__wasilibc_register_preopened_fd
__wasilibc_rename_newat
__wasilibc_rename_oldat
__wasilibc_report_error
__wasilibc_report_errorf
__wasilibc_reset_preopens
__wasilibc_rmdirat
__wasilibc_stat
__wasilibc_tell
__wasilibc_unlinkat
__wasilibc_use_busy_futex
__wasilibc_utf8_abort_current
__wasilibc_utf8_reset
__wasilibc_utf8_write
__wasilibc_utimens
__wasilibc_validate_utf8
__wasm_call_dtors
__wcscoll_l
__wcsftime_l
Expand Down
1 change: 1 addition & 0 deletions expected/wasm32-wasip1-threads/include-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,6 @@
#include <wasi/wasip1.h>
#include <wasi/wasip2.h>
#include <wasi/wasip3.h>
#include <wasi/webp2.h>
#include <wchar.h>
#include <wctype.h>
1 change: 1 addition & 0 deletions expected/wasm32-wasip1-threads/predefined-macros.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3064,6 +3064,7 @@
#define __WASI_VERSION_H
#define __WASI_WASIP2_H
#define __WASI_WASIP3_H
#define __WASI_WEBP2_H
#define __WASI_WHENCE_CUR (UINT8_C(1))
#define __WASI_WHENCE_END (UINT8_C(2))
#define __WASI_WHENCE_SET (UINT8_C(0))
Expand Down
6 changes: 6 additions & 0 deletions expected/wasm32-wasip1/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,18 @@ __wasilibc_pthread_self
__wasilibc_register_preopened_fd
__wasilibc_rename_newat
__wasilibc_rename_oldat
__wasilibc_report_error
__wasilibc_report_errorf
__wasilibc_reset_preopens
__wasilibc_rmdirat
__wasilibc_stat
__wasilibc_tell
__wasilibc_unlinkat
__wasilibc_utf8_abort_current
__wasilibc_utf8_reset
__wasilibc_utf8_write
__wasilibc_utimens
__wasilibc_validate_utf8
__wasm_call_dtors
__wcscoll_l
__wcsftime_l
Expand Down
1 change: 1 addition & 0 deletions expected/wasm32-wasip1/include-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,6 @@
#include <wasi/wasip1.h>
#include <wasi/wasip2.h>
#include <wasi/wasip3.h>
#include <wasi/webp2.h>
#include <wchar.h>
#include <wctype.h>
1 change: 1 addition & 0 deletions expected/wasm32-wasip1/predefined-macros.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3063,6 +3063,7 @@
#define __WASI_VERSION_H
#define __WASI_WASIP2_H
#define __WASI_WASIP3_H
#define __WASI_WEBP2_H
#define __WASI_WHENCE_CUR (UINT8_C(1))
#define __WASI_WHENCE_END (UINT8_C(2))
#define __WASI_WHENCE_SET (UINT8_C(0))
Expand Down
Loading
Loading