@@ -96,17 +96,23 @@ This target can be cross-compiled from any host.
96
96
## Emscripten ABI Compatibility
97
97
98
98
The 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:
105
107
106
108
``` sh
107
109
cargo +nightly -Zbuild-std build
108
110
```
109
111
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
+
110
116
## Testing
111
117
112
118
This 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
156
162
` -fexceptions ` (JS exceptions) by default unless the Rust code is compiled with
157
163
` -Cpanic=abort ` . ` -fwasm-exceptions ` (WASM exceptions) is not yet currently supported,
158
164
see < 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