mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 11:16:42 +01:00
add filter-exports command to automatically remove unused exports
this removes the need for a manual step in the rust example
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
rustc --target=wasm32-unknown-unknown --crate-type cdylib -C opt-level="z" -C "link-args=--import-memory --initial-memory=262144 -zstack-size=65536" -o tunnel.wasm tunnel.rs && \
|
||||
uw8 filter-exports tunnel.wasm tunnel.wasm && \
|
||||
wasm-opt -Oz -o tunnel.wasm tunnel.wasm
|
||||
|
||||
@@ -18,8 +18,10 @@ these globals and exports:
|
||||
|
||||
They are meant to be used for heap allocations and stack for any
|
||||
values that are not simple scalars (i32, f32, etc.). Since our
|
||||
code doesn't actually use any of that, we can just delete them
|
||||
in a text editor and assemble the code again with wat2wasm.
|
||||
code doesn't actually use any of that, the globals are only
|
||||
referenced by the exports and we can remove them using
|
||||
'uw8 filter-exports' (preferably before running wasm-opt) which
|
||||
removes all exports except those used by the MicroW8 platform.
|
||||
|
||||
This gives us a 216 byte wasm file. Running this through
|
||||
uw8 pack brings us to the final size of 119 bytes.
|
||||
Reference in New Issue
Block a user