@@ -96,17 +96,23 @@ This target can be cross-compiled from any host.
9696## Emscripten ABI Compatibility
9797
9898The Emscripten compiler toolchain does not follow a semantic versioning scheme
99- that clearly indicates when breaking changes to the ABI can be made. If you are
100- using the pre-compiled ` std ` from rustup, it may be compiled with a different
101- Emscripten version than the local Emscripten you have installed. If a breaking
102- change to the ABI was made in between the two versions, your code will exhibit
103- undefined behaviour. If you come across issues, you can rebuild the Rust standard
104- library with your local Emscripten version using
99+ that clearly indicates when breaking changes to the ABI can be made. Additionally,
100+ Emscripten offers many different ABIs even for a single version of Emscripten
101+ depending on the linker flags used, e.g. ` -fexceptions ` and ` -sWASM_BIGINT ` . If
102+ the ABIs mismatch, your code may exhibit undefined behaviour.
103+
104+ To ensure that the ABIs of your Rust code, of the Rust standard library, and of
105+ other code compiled for Emscripten all match, you should rebuild the Rust standard
106+ library with your local Emscripten version and settings using:
105107
106108``` sh
107109cargo +nightly -Zbuild-std build
108110```
109111
112+ If you still want to use the pre-compiled ` std ` from rustup, you should ensure
113+ that your local Emscripten matches the version used by Rust and be careful about
114+ any ` -C link-arg ` s that you compiled your Rust code with.
115+
110116## Testing
111117
112118This target is not extensively tested in CI for the rust-lang/rust repository. It
@@ -156,3 +162,8 @@ Note that Rust code compiled for `wasm32-unknown-emscripten` currently enables
156162` -fexceptions ` (JS exceptions) by default unless the Rust code is compiled with
157163` -Cpanic=abort ` . ` -fwasm-exceptions ` (WASM exceptions) is not yet currently supported,
158164see < https://github.com/rust-lang/rust/issues/112195 > .
165+
166+ Please refer to the [ Emscripten ABI compatibility] ( #emscripten-abi-compatibility )
167+ section to ensure that the features that are enabled do not cause an ABI mismatch
168+ between your Rust code, the pre-compiled Rust standard library, and other code compiled
169+ for Emscripten.
0 commit comments