Repository: rust
Issue: Compiling std with multivalue feature on wasm32-unknown-unknown target fails
Labels: T-compiler,O-wasm,C-bug

I tried this code:

`src/lib.rs`:
```rust
#[no_mangle]
pub extern fn return_two_nums() -> (i32, i32) {
    (0, 1)
}
```
and compiled it with `RUSTFLAGS="-C target-feature=+multivalue" cargo build -Z build-std=std,panic_abort --target=wasm32-unknown-unknown `

Expected: to compile and link it without any errors

Instead, this happened: It seems like everything compiles successfully, but linking fails
```
   Compiling wasm32-bug v0.1.0 (/home/protheory8/wasm32-bug)
warning: `extern` fn uses type `(i32, i32)`, which is not FFI-safe
 --> src/lib.rs:2:36
  |
2 | pub extern fn return_two_nums() -> (i32, i32) {
  |                                    ^^^^^^^^^^ not FFI-safe
  |
  = note: `#[warn(improper_ctypes_definitions)]` on by default
  = help: consider using a struct instead
  = note: tuples have unspecified layout

error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "wasm" "--rsp-quoting=posix" "-z" "stack-size=1048576" "--stack-first" "--allow-undefined" "--fatal-warnings" "--no-demangle" "--no-entry" "--export-dynamic" "-L" "/home/protheory8/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib" "-L" "/home/protheory8/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/self-contained" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/wasm32_bug.71ssxutnzvyhpcu.rcgu.o" "-o" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/wasm32_bug.wasm" "--export" "return_two_nums" "--export=__heap_base" "--export=__data_end" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/wasm32_bug.4orz6m03gj8b4xnw.rcgu.o" "--gc-sections" "--no-entry" "-O0" "-L" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps" "-L" "/home/protheory8/wasm32-bug/target/debug/deps" "-L" "/home/protheory8/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libstd-beccc785673c6aeb.rlib" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libpanic_abort-24b0daee374c1553.rlib" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libdlmalloc-dab06be4348a73d4.rlib" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/librustc_demangle-6276c86cadb17429.rlib" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libhashbrown-d06a9c000b1168cb.rlib" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/librustc_std_workspace_alloc-b882333370fd6ce1.rlib" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libunwind-434f7b253a0030e9.rlib" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcfg_if-92ffa7a39869d8ae.rlib" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/liblibc-45e0a57f04e65265.rlib" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/liballoc-0212469e737d53d5.rlib" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/librustc_std_workspace_core-3a74e5752e0920c4.rlib" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcore-efdd6a8e96e2450c.rlib" "/home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib"
  = note: rust-lld: error: function signature mismatch: __udivti3
          >>> defined as (i32, i64, i64, i64, i64) -> void in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcore-efdd6a8e96e2450c.rlib(core-efdd6a8e96e2450c.core.ctsfpwqf-cgu.1.rcgu.o)
          >>> defined as (i64, i64, i64, i64) -> i64 in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib(compiler_builtins-2e9b232f6c0a1e80.compiler_builtins.1oq7nsiy-cgu.4.rcgu.o)
          
          rust-lld: error: function signature mismatch: __ashlti3
          >>> defined as (i32, i64, i64, i32) -> void in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib(compiler_builtins-2e9b232f6c0a1e80.compiler_builtins.1oq7nsiy-cgu.10.rcgu.o)
          >>> defined as (i64, i64, i32) -> i64 in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib(compiler_builtins-2e9b232f6c0a1e80.compiler_builtins.1oq7nsiy-cgu.4.rcgu.o)
          
          rust-lld: error: function signature mismatch: __multi3
          >>> defined as (i32, i64, i64, i64, i64) -> void in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/librustc_demangle-6276c86cadb17429.rlib(rustc_demangle-6276c86cadb17429.rustc_demangle.7ezo834z-cgu.8.rcgu.o)
          >>> defined as (i64, i64, i64, i64) -> i64 in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib(compiler_builtins-2e9b232f6c0a1e80.compiler_builtins.1oq7nsiy-cgu.4.rcgu.o)
          
          rust-lld: error: function signature mismatch: __ashrti3
          >>> defined as (i32, i64, i64, i32) -> void in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib(compiler_builtins-2e9b232f6c0a1e80.compiler_builtins.1oq7nsiy-cgu.10.rcgu.o)
          >>> defined as (i64, i64, i32) -> i64 in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib(compiler_builtins-2e9b232f6c0a1e80.compiler_builtins.1oq7nsiy-cgu.4.rcgu.o)
          
          rust-lld: error: function signature mismatch: __umodti3
          >>> defined as (i32, i64, i64, i64, i64) -> void in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcore-efdd6a8e96e2450c.rlib(core-efdd6a8e96e2450c.core.ctsfpwqf-cgu.1.rcgu.o)
          >>> defined as (i64, i64, i64, i64) -> i64 in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib(compiler_builtins-2e9b232f6c0a1e80.compiler_builtins.1oq7nsiy-cgu.4.rcgu.o)
          
          rust-lld: error: function signature mismatch: __lshrti3
          >>> defined as (i32, i64, i64, i32) -> void in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcore-efdd6a8e96e2450c.rlib(core-efdd6a8e96e2450c.core.ctsfpwqf-cgu.2.rcgu.o)
          >>> defined as (i64, i64, i32) -> i64 in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib(compiler_builtins-2e9b232f6c0a1e80.compiler_builtins.1oq7nsiy-cgu.4.rcgu.o)
          
          rust-lld: error: function signature mismatch: __muloti4
          >>> defined as (i32, i64, i64, i64, i64, i32) -> void in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcore-efdd6a8e96e2450c.rlib(core-efdd6a8e96e2450c.core.ctsfpwqf-cgu.2.rcgu.o)
          >>> defined as (i64, i64, i64, i64, i32) -> i64 in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib(compiler_builtins-2e9b232f6c0a1e80.compiler_builtins.1oq7nsiy-cgu.11.rcgu.o)
          
          rust-lld: error: function signature mismatch: __divti3
          >>> defined as (i32, i64, i64, i64, i64) -> void in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib(compiler_builtins-2e9b232f6c0a1e80.compiler_builtins.1oq7nsiy-cgu.10.rcgu.o)
          >>> defined as (i64, i64, i64, i64) -> i64 in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib(compiler_builtins-2e9b232f6c0a1e80.compiler_builtins.1oq7nsiy-cgu.4.rcgu.o)
          
          rust-lld: error: function signature mismatch: __modti3
          >>> defined as (i32, i64, i64, i64, i64) -> void in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib(compiler_builtins-2e9b232f6c0a1e80.compiler_builtins.1oq7nsiy-cgu.10.rcgu.o)
          >>> defined as (i64, i64, i64, i64) -> i64 in /home/protheory8/wasm32-bug/target/wasm32-unknown-unknown/debug/deps/libcompiler_builtins-2e9b232f6c0a1e80.rlib(compiler_builtins-2e9b232f6c0a1e80.compiler_builtins.1oq7nsiy-cgu.4.rcgu.o)
          

error: aborting due to previous error; 1 warning emitted

error: could not compile `wasm32-bug`
```

### Meta
`rustc --version --verbose`:
```
rustc 1.53.0-nightly (07e0e2ec2 2021-03-24)
binary: rustc
commit-hash: 07e0e2ec268c140e607e1ac7f49f145612d0f597
commit-date: 2021-03-24
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0
```

`Cargo.toml`:
```toml
[package]
name = "wasm32-bug"
version = "0.1.0"
authors = ["protheory8"]
edition = "2018"

[lib]
crate-type = ["cdylib"]
```