Skip to content

Commit 55df1f5

Browse files
authored
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 <joel.dice@fermyon.com> * 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 <joel.dice@fermyon.com> --------- Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent 212296e commit 55df1f5

7 files changed

Lines changed: 313 additions & 428 deletions

File tree

Makefile

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,10 @@ OBJDIR ?= build/$(TARGET_TRIPLE)
2626
# The directory where we store files and tools for generating WASI Preview 2 bindings
2727
BINDING_WORK_DIR ?= build/bindings
2828
# URL from which to retrieve the WIT files used to generate the WASI Preview 2 bindings
29-
WASI_CLI_URL ?= https://github.com/WebAssembly/wasi-cli/archive/refs/tags/v0.2.0-rc-2023-12-05.tar.gz
29+
WASI_CLI_URL ?= https://github.com/WebAssembly/wasi-cli/archive/refs/tags/v0.2.0.tar.gz
3030
# URL from which to retrieve the `wit-bindgen` command used to generate the WASI
3131
# Preview 2 bindings.
32-
#
33-
# TODO: Switch to bytecodealliance/wit-bindgen 0.17.0 once it's released (which
34-
# will include https://github.com/bytecodealliance/wit-bindgen/pull/804 and
35-
# https://github.com/bytecodealliance/wit-bindgen/pull/805, which we rely on)
36-
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
32+
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
3733

3834
# When the length is no larger than this threshold, we consider the
3935
# overhead of bulk memory opcodes to outweigh the performance benefit,
@@ -854,40 +850,41 @@ $(BINDING_WORK_DIR)/wit-bindgen:
854850
bindings: $(BINDING_WORK_DIR)/wasi-cli $(BINDING_WORK_DIR)/wit-bindgen
855851
cd "$(BINDING_WORK_DIR)" && \
856852
./wit-bindgen/wit-bindgen c \
853+
--autodrop-borrows yes \
857854
--rename-world preview2 \
858855
--type-section-suffix __wasi_libc \
859-
--world wasi:cli/imports@0.2.0-rc-2023-12-05 \
860-
--rename wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-10=monotonic_clock \
861-
--rename wasi:clocks/wall-clock@0.2.0-rc-2023-11-10=wall_clock \
862-
--rename wasi:filesystem/preopens@0.2.0-rc-2023-11-10=filesystem_preopens \
863-
--rename wasi:filesystem/types@0.2.0-rc-2023-11-10=filesystem \
864-
--rename wasi:io/error@0.2.0-rc-2023-11-10=io_error \
865-
--rename wasi:io/poll@0.2.0-rc-2023-11-10=poll \
866-
--rename wasi:io/streams@0.2.0-rc-2023-11-10=streams \
867-
--rename wasi:random/insecure-seed@0.2.0-rc-2023-11-10=random_insecure_seed \
868-
--rename wasi:random/insecure@0.2.0-rc-2023-11-10=random_insecure \
869-
--rename wasi:random/random@0.2.0-rc-2023-11-10=random \
870-
--rename wasi:sockets/instance-network@0.2.0-rc-2023-11-10=instance_network \
871-
--rename wasi:sockets/ip-name-lookup@0.2.0-rc-2023-11-10=ip_name_lookup \
872-
--rename wasi:sockets/network@0.2.0-rc-2023-11-10=network \
873-
--rename wasi:sockets/tcp-create-socket@0.2.0-rc-2023-11-10=tcp_create_socket \
874-
--rename wasi:sockets/tcp@0.2.0-rc-2023-11-10=tcp \
875-
--rename wasi:sockets/udp-create-socket@0.2.0-rc-2023-11-10=udp_create_socket \
876-
--rename wasi:sockets/udp@0.2.0-rc-2023-11-10=udp \
877-
--rename wasi:cli/environment@0.2.0-rc-2023-12-05=environment \
878-
--rename wasi:cli/exit@0.2.0-rc-2023-12-05=exit \
879-
--rename wasi:cli/stdin@0.2.0-rc-2023-12-05=stdin \
880-
--rename wasi:cli/stdout@0.2.0-rc-2023-12-05=stdout \
881-
--rename wasi:cli/stderr@0.2.0-rc-2023-12-05=stderr \
882-
--rename wasi:cli/terminal-input@0.2.0-rc-2023-12-05=terminal_input \
883-
--rename wasi:cli/terminal-output@0.2.0-rc-2023-12-05=terminal_output \
884-
--rename wasi:cli/terminal-stdin@0.2.0-rc-2023-12-05=terminal_stdin \
885-
--rename wasi:cli/terminal-stdout@0.2.0-rc-2023-12-05=terminal_stdout \
886-
--rename wasi:cli/terminal-stderr@0.2.0-rc-2023-12-05=terminal_stderr \
856+
--world wasi:cli/imports@0.2.0 \
857+
--rename wasi:clocks/monotonic-clock@0.2.0=monotonic_clock \
858+
--rename wasi:clocks/wall-clock@0.2.0=wall_clock \
859+
--rename wasi:filesystem/preopens@0.2.0=filesystem_preopens \
860+
--rename wasi:filesystem/types@0.2.0=filesystem \
861+
--rename wasi:io/error@0.2.0=io_error \
862+
--rename wasi:io/poll@0.2.0=poll \
863+
--rename wasi:io/streams@0.2.0=streams \
864+
--rename wasi:random/insecure-seed@0.2.0=random_insecure_seed \
865+
--rename wasi:random/insecure@0.2.0=random_insecure \
866+
--rename wasi:random/random@0.2.0=random \
867+
--rename wasi:sockets/instance-network@0.2.0=instance_network \
868+
--rename wasi:sockets/ip-name-lookup@0.2.0=ip_name_lookup \
869+
--rename wasi:sockets/network@0.2.0=network \
870+
--rename wasi:sockets/tcp-create-socket@0.2.0=tcp_create_socket \
871+
--rename wasi:sockets/tcp@0.2.0=tcp \
872+
--rename wasi:sockets/udp-create-socket@0.2.0=udp_create_socket \
873+
--rename wasi:sockets/udp@0.2.0=udp \
874+
--rename wasi:cli/environment@0.2.0=environment \
875+
--rename wasi:cli/exit@0.2.0=exit \
876+
--rename wasi:cli/stdin@0.2.0=stdin \
877+
--rename wasi:cli/stdout@0.2.0=stdout \
878+
--rename wasi:cli/stderr@0.2.0=stderr \
879+
--rename wasi:cli/terminal-input@0.2.0=terminal_input \
880+
--rename wasi:cli/terminal-output@0.2.0=terminal_output \
881+
--rename wasi:cli/terminal-stdin@0.2.0=terminal_stdin \
882+
--rename wasi:cli/terminal-stdout@0.2.0=terminal_stdout \
883+
--rename wasi:cli/terminal-stderr@0.2.0=terminal_stderr \
887884
./wasi-cli/wit && \
888885
mv preview2.h ../../libc-bottom-half/headers/public/wasi/ && \
889886
mv preview2_component_type.o ../../libc-bottom-half/sources && \
890-
sed 's_#include "preview2.h"_#include "wasi/preview2.h"_' \
887+
sed 's_#include "preview2\.h"_#include "wasi/preview2.h"_' \
891888
< preview2.c \
892889
> ../../libc-bottom-half/sources/preview2.c && \
893890
rm preview2.c

expected/wasm32-wasi-preview2/defined-symbols.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,6 @@ tcp_method_tcp_socket_finish_bind
12351235
tcp_method_tcp_socket_finish_connect
12361236
tcp_method_tcp_socket_finish_listen
12371237
tcp_method_tcp_socket_hop_limit
1238-
tcp_method_tcp_socket_ipv6_only
12391238
tcp_method_tcp_socket_is_listening
12401239
tcp_method_tcp_socket_keep_alive_count
12411240
tcp_method_tcp_socket_keep_alive_enabled
@@ -1246,7 +1245,6 @@ tcp_method_tcp_socket_receive_buffer_size
12461245
tcp_method_tcp_socket_remote_address
12471246
tcp_method_tcp_socket_send_buffer_size
12481247
tcp_method_tcp_socket_set_hop_limit
1249-
tcp_method_tcp_socket_set_ipv6_only
12501248
tcp_method_tcp_socket_set_keep_alive_count
12511249
tcp_method_tcp_socket_set_keep_alive_enabled
12521250
tcp_method_tcp_socket_set_keep_alive_idle_time
@@ -1329,12 +1327,10 @@ udp_method_outgoing_datagram_stream_send
13291327
udp_method_outgoing_datagram_stream_subscribe
13301328
udp_method_udp_socket_address_family
13311329
udp_method_udp_socket_finish_bind
1332-
udp_method_udp_socket_ipv6_only
13331330
udp_method_udp_socket_local_address
13341331
udp_method_udp_socket_receive_buffer_size
13351332
udp_method_udp_socket_remote_address
13361333
udp_method_udp_socket_send_buffer_size
1337-
udp_method_udp_socket_set_ipv6_only
13381334
udp_method_udp_socket_set_receive_buffer_size
13391335
udp_method_udp_socket_set_send_buffer_size
13401336
udp_method_udp_socket_set_unicast_hop_limit
@@ -1346,7 +1342,6 @@ udp_option_ip_socket_address_free
13461342
udp_outgoing_datagram_free
13471343
udp_outgoing_datagram_stream_drop_borrow
13481344
udp_outgoing_datagram_stream_drop_own
1349-
udp_result_bool_error_code_free
13501345
udp_result_ip_socket_address_error_code_free
13511346
udp_result_list_incoming_datagram_error_code_free
13521347
udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_free

expected/wasm32-wasi-preview2/undefined-symbols.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ __wasm_import_tcp_method_tcp_socket_finish_bind
151151
__wasm_import_tcp_method_tcp_socket_finish_connect
152152
__wasm_import_tcp_method_tcp_socket_finish_listen
153153
__wasm_import_tcp_method_tcp_socket_hop_limit
154-
__wasm_import_tcp_method_tcp_socket_ipv6_only
155154
__wasm_import_tcp_method_tcp_socket_is_listening
156155
__wasm_import_tcp_method_tcp_socket_keep_alive_count
157156
__wasm_import_tcp_method_tcp_socket_keep_alive_enabled
@@ -162,7 +161,6 @@ __wasm_import_tcp_method_tcp_socket_receive_buffer_size
162161
__wasm_import_tcp_method_tcp_socket_remote_address
163162
__wasm_import_tcp_method_tcp_socket_send_buffer_size
164163
__wasm_import_tcp_method_tcp_socket_set_hop_limit
165-
__wasm_import_tcp_method_tcp_socket_set_ipv6_only
166164
__wasm_import_tcp_method_tcp_socket_set_keep_alive_count
167165
__wasm_import_tcp_method_tcp_socket_set_keep_alive_enabled
168166
__wasm_import_tcp_method_tcp_socket_set_keep_alive_idle_time
@@ -190,12 +188,10 @@ __wasm_import_udp_method_outgoing_datagram_stream_send
190188
__wasm_import_udp_method_outgoing_datagram_stream_subscribe
191189
__wasm_import_udp_method_udp_socket_address_family
192190
__wasm_import_udp_method_udp_socket_finish_bind
193-
__wasm_import_udp_method_udp_socket_ipv6_only
194191
__wasm_import_udp_method_udp_socket_local_address
195192
__wasm_import_udp_method_udp_socket_receive_buffer_size
196193
__wasm_import_udp_method_udp_socket_remote_address
197194
__wasm_import_udp_method_udp_socket_send_buffer_size
198-
__wasm_import_udp_method_udp_socket_set_ipv6_only
199195
__wasm_import_udp_method_udp_socket_set_receive_buffer_size
200196
__wasm_import_udp_method_udp_socket_set_send_buffer_size
201197
__wasm_import_udp_method_udp_socket_set_unicast_hop_limit

0 commit comments

Comments
 (0)