Closed hunjixin closed 11 months ago
@sbc100 Sorry to revive an old issue, but do you know if there is a way of disabling bulk memory when compiling from Rust? Have tried
RUSTFLAGS='-C target-cpu=mvp -C target-feature=-bulk-memory' cargo build --release --target=wasm32-wasi
but does not seem to work.
Use cargo-zigbuild
:
cargo zigbuild --target=wasm32-wasi --release
The built-in wasi-libc
is always recompiled according for the target CPU and flags. By default, this is baseline
, that doesn't enable any extension, including bulk-memory
.
If you want to get an optimized build for another runtime by enabling flags (that will also apply to wasi-libc
), you can do it:
export CFLAGS="-mcpu=baseline+bulk_memory+atomics+simd128+relaxed_simd"
cargo zigbuild --target=wasm32-wasi --release
Bulk memory is enabled in Makefile here: https://github.com/WebAssembly/wasi-libc/blob/6575e7d84899d282f73d36c1b1f18810502145e3/Makefile#L400-L403.
You would need to edit the Makefile to turn it off.
We are about to enable bulk memory in llvm by default. Can I ask what engine you are targeting that doesn't support it?