Skip to content

Commit 8d8348e

Browse files
authored
Update WASIp2 bindings to 0.2.12, use exit-with-code (#860)
So far wasi-libc has never updated its wasip2 bindings, and I feel it's about time this is done. This is used to get access to exit-with-code. Users needing to use the older version of WASIp2 can continue to use historical versions of wasi-libc/wasi-sdk, much the same as needing to use an older LLVM version.
1 parent 6d8745c commit 8d8348e

19 files changed

Lines changed: 1209 additions & 723 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ else()
153153
message(FATAL_ERROR "Unknown WASI version: ${WASI}")
154154
endif()
155155

156-
set(wasip2-version 0.2.0)
156+
set(wasip2-version 0.2.12)
157157
set(wasip3-version 0.3.0)
158158

159159
# =============================================================================

expected/wasm32-wasip2/defined-symbols.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ erfl
576576
errno
577577
exit
578578
exit_exit
579+
exit_exit_with_code
579580
exit_result_void_void_free
580581
exp
581582
exp10

expected/wasm32-wasip2/undefined-symbols.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ __wasm_import_environment_get_arguments
2626
__wasm_import_environment_get_environment
2727
__wasm_import_environment_initial_cwd
2828
__wasm_import_exit_exit
29+
__wasm_import_exit_exit_with_code
2930
__wasm_import_filesystem_descriptor_drop
3031
__wasm_import_filesystem_directory_entry_stream_drop
3132
__wasm_import_filesystem_filesystem_error_code

libc-bottom-half/cloudlibc/src/libc/stdlib/_Exit.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
noreturn void _Exit(int status) {
1111
#if defined(__wasip1__)
1212
__wasi_proc_exit(status);
13-
#elif defined(__wasip2__)
14-
exit_result_void_void_t exit_status = { .is_err = status != 0 };
15-
exit_exit(&exit_status);
16-
#elif defined(__wasip3__)
13+
#elif defined(__wasip2__) || defined(__wasip3__)
1714
if (status >= 0 && status <= 255)
1815
exit_exit_with_code(status);
1916
exit_result_void_void_t exit_status = { .is_err = status != 0 };

libc-bottom-half/crt/crt1-command.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ __attribute__((export_name("_start"))) void _start(void)
1818
// doing. Given the special nature of this symbol this skip the typical
1919
// `wit-bindgen` rigamarole and the signature of this function is simple enough
2020
// that this shouldn't be too problematic (in theory).
21-
__attribute__((export_name("wasi:cli/run@0.2.0#run"))) int _start(void)
21+
__attribute__((export_name("wasi:cli/run@0.2.12#run"))) int _start(void)
2222
#elif defined(__wasip3__)
2323
__attribute__((export_name("wasi:cli/run@0.3.0#run"))) int _start(void)
2424
#else

libc-bottom-half/headers/public/wasi/__generated_wasip2.h

Lines changed: 88 additions & 105 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libc-bottom-half/sources/wasip2.c

Lines changed: 167 additions & 160 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
65 Bytes
Binary file not shown.

wasi/p2/wit/deps/wasi-cli-0.2.0/package.wit

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

0 commit comments

Comments
 (0)