-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
WebAssembly ABI mismatch between clang and rust #71871
Copy link
Copy link
Closed
Labels
A-ABIArea: Concerning the application binary interface (ABI)Area: Concerning the application binary interface (ABI)A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)C-bugCategory: This is a bug.Category: This is a bug.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-ABIArea: Concerning the application binary interface (ABI)Area: Concerning the application binary interface (ABI)A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)C-bugCategory: This is a bug.Category: This is a bug.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
When I compile this C code to
wasm32-wasi:And this Rust code to
wasm32-wasi:And try link them together, I'm getting linking errors:
It seems that, according to clang, passing a struct by value should inline the fields, while for Rust it should be passed by pointer.
I uploaded an example project here: https://github.com/tomaka/wasm-abi-test
It can be built with something like:
Rust version: rustc 1.44.0-nightly (38114ff 2020-03-21)