Skip to content

WASM compilation broken on nightly? #53390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jD91mZM2 opened this issue Aug 15, 2018 · 4 comments
Closed

WASM compilation broken on nightly? #53390

jD91mZM2 opened this issue Aug 15, 2018 · 4 comments

Comments

@jD91mZM2
Copy link
Contributor

A thing works fine when compiled with stable rust, but fails at runtime with nightly.

I tried this code:
https://github.com/jD91mZM2/jD91mZM2.github.io

I expected this to happen:
It'd compile and work, just like it used to.

Instead, this happened:

wasm validation error: at offset 1121: type mismatch: expression has type i32 but expected f64

It appears it has to do something with

extern {
    fn alert(string: *mut u16);
    fn log(string: *mut u16);
}

Specifically, changing them to take f64 instead fails with:

wasm validation error: at offset 2859: unused values not explicitly dropped by end of block

Meta

rustc --version --verbose:

rustc 1.30.0-nightly (67390c0c3 2018-08-14)
binary: rustc
commit-hash: 67390c0c312ca2d8649ee7aa1e4bfa823f273857
commit-date: 2018-08-14
host: x86_64-unknown-linux-gnu
release: 1.30.0-nightly
LLVM version: 7.0
@jD91mZM2
Copy link
Contributor Author

Now pushed to stable 1.29. Great.

@Mark-Simulacrum
Copy link
Member

Cc @alexcrichton

@alexcrichton
Copy link
Member

Ah it looks like this is a symbol conflict error:

rust-lld: error: function signature mismatch: log
>>> defined as (I32, I32, I32) -> void in wasm.wasm.ao2yllok-cgu.2.rcgu.o
>>> defined as (F64) -> F64 in /home/alex/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libcompiler_builtins-6955fc9706c7939a.rlib(compiler_builtins-6955fc9706c7939a.compiler_builtins.9y7epby1-cgu.14.rcgu.o)

You'll want to rename your log import as it conflicts with the symbol log in compiler-rt

@jD91mZM2
Copy link
Contributor Author

Oh, I see, thanks!

alexcrichton added a commit to alexcrichton/rust that referenced this issue Sep 15, 2018
Historically LLD has emitted warnings for various reasons but all the bugs have
since been fixed (yay!) and by enabling fatal warnings we should be able to head
off bugs like rust-lang#53390 sooner.
kennytm added a commit to kennytm/rust that referenced this issue Sep 20, 2018
…eddyb

Enable fatal warnings for the wasm32 linker

Historically LLD has emitted warnings for various reasons but all the bugs have
since been fixed (yay!) and by enabling fatal warnings we should be able to head
off bugs like rust-lang#53390 sooner.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants