Skip to content

Commit

Permalink
split component new rule out of link rule for Preview 2
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dicej committed Feb 12, 2024
1 parent a5065e6 commit 4c44291
Show file tree
Hide file tree
Showing 7 changed files with 315 additions and 434 deletions.
65 changes: 31 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -853,36 +849,37 @@ $(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 && \
Expand Down
5 changes: 0 additions & 5 deletions expected/wasm32-wasi-preview2/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,6 @@ tcp_method_tcp_socket_finish_bind
tcp_method_tcp_socket_finish_connect
tcp_method_tcp_socket_finish_listen
tcp_method_tcp_socket_hop_limit
tcp_method_tcp_socket_ipv6_only
tcp_method_tcp_socket_is_listening
tcp_method_tcp_socket_keep_alive_count
tcp_method_tcp_socket_keep_alive_enabled
Expand All @@ -1245,7 +1244,6 @@ tcp_method_tcp_socket_receive_buffer_size
tcp_method_tcp_socket_remote_address
tcp_method_tcp_socket_send_buffer_size
tcp_method_tcp_socket_set_hop_limit
tcp_method_tcp_socket_set_ipv6_only
tcp_method_tcp_socket_set_keep_alive_count
tcp_method_tcp_socket_set_keep_alive_enabled
tcp_method_tcp_socket_set_keep_alive_idle_time
Expand Down Expand Up @@ -1328,12 +1326,10 @@ udp_method_outgoing_datagram_stream_send
udp_method_outgoing_datagram_stream_subscribe
udp_method_udp_socket_address_family
udp_method_udp_socket_finish_bind
udp_method_udp_socket_ipv6_only
udp_method_udp_socket_local_address
udp_method_udp_socket_receive_buffer_size
udp_method_udp_socket_remote_address
udp_method_udp_socket_send_buffer_size
udp_method_udp_socket_set_ipv6_only
udp_method_udp_socket_set_receive_buffer_size
udp_method_udp_socket_set_send_buffer_size
udp_method_udp_socket_set_unicast_hop_limit
Expand All @@ -1345,7 +1341,6 @@ udp_option_ip_socket_address_free
udp_outgoing_datagram_free
udp_outgoing_datagram_stream_drop_borrow
udp_outgoing_datagram_stream_drop_own
udp_result_bool_error_code_free
udp_result_ip_socket_address_error_code_free
udp_result_list_incoming_datagram_error_code_free
udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_free
Expand Down
4 changes: 0 additions & 4 deletions expected/wasm32-wasi-preview2/undefined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ __wasm_import_tcp_method_tcp_socket_finish_bind
__wasm_import_tcp_method_tcp_socket_finish_connect
__wasm_import_tcp_method_tcp_socket_finish_listen
__wasm_import_tcp_method_tcp_socket_hop_limit
__wasm_import_tcp_method_tcp_socket_ipv6_only
__wasm_import_tcp_method_tcp_socket_is_listening
__wasm_import_tcp_method_tcp_socket_keep_alive_count
__wasm_import_tcp_method_tcp_socket_keep_alive_enabled
Expand All @@ -162,7 +161,6 @@ __wasm_import_tcp_method_tcp_socket_receive_buffer_size
__wasm_import_tcp_method_tcp_socket_remote_address
__wasm_import_tcp_method_tcp_socket_send_buffer_size
__wasm_import_tcp_method_tcp_socket_set_hop_limit
__wasm_import_tcp_method_tcp_socket_set_ipv6_only
__wasm_import_tcp_method_tcp_socket_set_keep_alive_count
__wasm_import_tcp_method_tcp_socket_set_keep_alive_enabled
__wasm_import_tcp_method_tcp_socket_set_keep_alive_idle_time
Expand Down Expand Up @@ -190,12 +188,10 @@ __wasm_import_udp_method_outgoing_datagram_stream_send
__wasm_import_udp_method_outgoing_datagram_stream_subscribe
__wasm_import_udp_method_udp_socket_address_family
__wasm_import_udp_method_udp_socket_finish_bind
__wasm_import_udp_method_udp_socket_ipv6_only
__wasm_import_udp_method_udp_socket_local_address
__wasm_import_udp_method_udp_socket_receive_buffer_size
__wasm_import_udp_method_udp_socket_remote_address
__wasm_import_udp_method_udp_socket_send_buffer_size
__wasm_import_udp_method_udp_socket_set_ipv6_only
__wasm_import_udp_method_udp_socket_set_receive_buffer_size
__wasm_import_udp_method_udp_socket_set_send_buffer_size
__wasm_import_udp_method_udp_socket_set_unicast_hop_limit
Expand Down
Loading

0 comments on commit 4c44291

Please sign in to comment.