-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update bindings and dependencies to WASI 0.2.0 (#471)
* make the Makefiles a bit more robust - Escape "." character in `sed` regex - Ensure that %.wasm target fails cleanly (i.e. without generating the target file) if `wasm-tools` fails Signed-off-by: Joel Dice <[email protected]> * split `component new` rule out of link rule for Preview 2 We now explicitly distinquish between core module files (%.core.wasm) and component files (%.wasm), which helps avoid the trickery in my previous commit. In order to test this properly, I needed to update the Wasmtime URL to point to v17.0.0 instead of dev (which we needed to do anyway), and that in turn required updating the bindings to use the final WASI 0.2.0 release. Signed-off-by: Joel Dice <[email protected]> --------- Signed-off-by: Joel Dice <[email protected]>
- Loading branch information
Showing
7 changed files
with
313 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,14 +26,10 @@ OBJDIR ?= build/$(TARGET_TRIPLE) | |
# The directory where we store files and tools for generating WASI Preview 2 bindings | ||
BINDING_WORK_DIR ?= build/bindings | ||
# URL from which to retrieve the WIT files used to generate the WASI Preview 2 bindings | ||
WASI_CLI_URL ?= https://github.com/WebAssembly/wasi-cli/archive/refs/tags/v0.2.0-rc-2023-12-05.tar.gz | ||
WASI_CLI_URL ?= https://github.com/WebAssembly/wasi-cli/archive/refs/tags/v0.2.0.tar.gz | ||
# URL from which to retrieve the `wit-bindgen` command used to generate the WASI | ||
# Preview 2 bindings. | ||
# | ||
# TODO: Switch to bytecodealliance/wit-bindgen 0.17.0 once it's released (which | ||
# will include https://github.com/bytecodealliance/wit-bindgen/pull/804 and | ||
# https://github.com/bytecodealliance/wit-bindgen/pull/805, which we rely on) | ||
WIT_BINDGEN_URL ?= https://github.com/dicej/wit-bindgen/releases/download/wit-bindgen-cli-0.17.0-dicej-pre0/wit-bindgen-v0.17.0-dicej-pre0-x86_64-linux.tar.gz | ||
WIT_BINDGEN_URL ?= https://github.com/bytecodealliance/wit-bindgen/releases/download/wit-bindgen-cli-0.17.0/wit-bindgen-v0.17.0-x86_64-linux.tar.gz | ||
|
||
# When the length is no larger than this threshold, we consider the | ||
# overhead of bulk memory opcodes to outweigh the performance benefit, | ||
|
@@ -854,40 +850,41 @@ $(BINDING_WORK_DIR)/wit-bindgen: | |
bindings: $(BINDING_WORK_DIR)/wasi-cli $(BINDING_WORK_DIR)/wit-bindgen | ||
cd "$(BINDING_WORK_DIR)" && \ | ||
./wit-bindgen/wit-bindgen c \ | ||
--autodrop-borrows yes \ | ||
--rename-world preview2 \ | ||
--type-section-suffix __wasi_libc \ | ||
--world wasi:cli/[email protected]-rc-2023-12-05 \ | ||
--rename wasi:clocks/[email protected]-rc-2023-11-10=monotonic_clock \ | ||
--rename wasi:clocks/[email protected]-rc-2023-11-10=wall_clock \ | ||
--rename wasi:filesystem/[email protected]-rc-2023-11-10=filesystem_preopens \ | ||
--rename wasi:filesystem/[email protected]-rc-2023-11-10=filesystem \ | ||
--rename wasi:io/[email protected]-rc-2023-11-10=io_error \ | ||
--rename wasi:io/[email protected]-rc-2023-11-10=poll \ | ||
--rename wasi:io/[email protected]-rc-2023-11-10=streams \ | ||
--rename wasi:random/[email protected]-rc-2023-11-10=random_insecure_seed \ | ||
--rename wasi:random/[email protected]-rc-2023-11-10=random_insecure \ | ||
--rename wasi:random/[email protected]-rc-2023-11-10=random \ | ||
--rename wasi:sockets/[email protected]-rc-2023-11-10=instance_network \ | ||
--rename wasi:sockets/[email protected]-rc-2023-11-10=ip_name_lookup \ | ||
--rename wasi:sockets/[email protected]-rc-2023-11-10=network \ | ||
--rename wasi:sockets/[email protected]-rc-2023-11-10=tcp_create_socket \ | ||
--rename wasi:sockets/[email protected]-rc-2023-11-10=tcp \ | ||
--rename wasi:sockets/[email protected]-rc-2023-11-10=udp_create_socket \ | ||
--rename wasi:sockets/[email protected]-rc-2023-11-10=udp \ | ||
--rename wasi:cli/[email protected]-rc-2023-12-05=environment \ | ||
--rename wasi:cli/[email protected]-rc-2023-12-05=exit \ | ||
--rename wasi:cli/[email protected]-rc-2023-12-05=stdin \ | ||
--rename wasi:cli/[email protected]-rc-2023-12-05=stdout \ | ||
--rename wasi:cli/[email protected]-rc-2023-12-05=stderr \ | ||
--rename wasi:cli/[email protected]-rc-2023-12-05=terminal_input \ | ||
--rename wasi:cli/[email protected]-rc-2023-12-05=terminal_output \ | ||
--rename wasi:cli/[email protected]-rc-2023-12-05=terminal_stdin \ | ||
--rename wasi:cli/[email protected]-rc-2023-12-05=terminal_stdout \ | ||
--rename wasi:cli/[email protected]-rc-2023-12-05=terminal_stderr \ | ||
--world wasi:cli/[email protected] \ | ||
--rename wasi:clocks/[email protected]=monotonic_clock \ | ||
--rename wasi:clocks/[email protected]=wall_clock \ | ||
--rename wasi:filesystem/[email protected]=filesystem_preopens \ | ||
--rename wasi:filesystem/[email protected]=filesystem \ | ||
--rename wasi:io/[email protected]=io_error \ | ||
--rename wasi:io/[email protected]=poll \ | ||
--rename wasi:io/[email protected]=streams \ | ||
--rename wasi:random/[email protected]=random_insecure_seed \ | ||
--rename wasi:random/[email protected]=random_insecure \ | ||
--rename wasi:random/[email protected]=random \ | ||
--rename wasi:sockets/[email protected]=instance_network \ | ||
--rename wasi:sockets/[email protected]=ip_name_lookup \ | ||
--rename wasi:sockets/[email protected]=network \ | ||
--rename wasi:sockets/[email protected]=tcp_create_socket \ | ||
--rename wasi:sockets/[email protected]=tcp \ | ||
--rename wasi:sockets/[email protected]=udp_create_socket \ | ||
--rename wasi:sockets/[email protected]=udp \ | ||
--rename wasi:cli/[email protected]=environment \ | ||
--rename wasi:cli/[email protected]=exit \ | ||
--rename wasi:cli/[email protected]=stdin \ | ||
--rename wasi:cli/[email protected]=stdout \ | ||
--rename wasi:cli/[email protected]=stderr \ | ||
--rename wasi:cli/[email protected]=terminal_input \ | ||
--rename wasi:cli/[email protected]=terminal_output \ | ||
--rename wasi:cli/[email protected]=terminal_stdin \ | ||
--rename wasi:cli/[email protected]=terminal_stdout \ | ||
--rename wasi:cli/[email protected]=terminal_stderr \ | ||
./wasi-cli/wit && \ | ||
mv preview2.h ../../libc-bottom-half/headers/public/wasi/ && \ | ||
mv preview2_component_type.o ../../libc-bottom-half/sources && \ | ||
sed 's_#include "preview2.h"_#include "wasi/preview2.h"_' \ | ||
sed 's_#include "preview2\.h"_#include "wasi/preview2.h"_' \ | ||
< preview2.c \ | ||
> ../../libc-bottom-half/sources/preview2.c && \ | ||
rm preview2.c | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.