WASM: how to remove runtime artifacts (__data_end, __heap_base)

wasm-opt can't remove exports, since those don't count as unused. That's why they weren't removed by rustc either.


The old wasi preview1 ABI spec says this:

Environments shall not access exports named __heap_base or __data_end. Toolchains are encouraged to avoid providing these exports.

("Environments" being host runtimes like the browser, or wasmtime, or what have you)

Strange that Rust woulde export these, or even include them in non-wasi builds. I wonder why they're mentioned at all, I've never been able to figure out what they're for.

1 Like