Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upbinaryen fails to validate wasm in asm2wasm #37555
Comments
This comment has been minimized.
This comment has been minimized.
Potentially unwinding related? |
alexcrichton
added
the
O-wasm
label
Nov 3, 2016
This comment has been minimized.
This comment has been minimized.
|
Thanks for the report @m4b. The invalid wasm is probably due to some LLVM construct that binaryen hasn't seen before. The I/O error is because file access does not work in emscripten by default and requires file system emulation. |
brson
changed the title
wasm compile errors
binaryen fails to validate wasm in asm2wasm
Dec 31, 2016
This comment has been minimized.
This comment has been minimized.
|
This seems to compile now with latest rust nightly and a newer emcc:
Unfortunately, I can't seem to get this program to run: extern crate goblin;
use std::default::Default;
// demonstrates "automagical" elf32/64 switches via cfg on arch and pub use hacks.
// SIZEOF_* will change depending on whether it's an x86_64 system or 32-bit x86, or really any cfg you can think of.
// similarly the printers will be different, since they have different impls. #typepuns4life
#[cfg(target_pointer_width = "64")]
pub use goblin::elf64 as elf;
#[cfg(target_pointer_width = "32")]
pub use goblin::elf32 as elf;
#[cfg(any(target_pointer_width = "64", target_pointer_width = "32"))]
use elf::{header, sym};
#[cfg(any(target_pointer_width = "64", target_pointer_width = "32"))]
fn main() {
let header: header::Header = Default::default();
let sym: sym::Sym = Default::default();
println!("header: {:?}, sym: {:?}", header, sym);
println!("sizeof header: {}", header::SIZEOF_EHDR);
println!("sizeof sym: {}", sym::SIZEOF_SYM);
}
The above uses no |
This comment has been minimized.
This comment has been minimized.
|
This works as expected when linked/compiled with
|
This comment has been minimized.
This comment has been minimized.
chicoxyzzy
commented
Jan 10, 2017
•
|
@m4b alternatively you can clone this fork of Node.js, switch to |
This comment has been minimized.
This comment has been minimized.
|
@chicoxyzzy good to know! I just realized I think we can force the |
This comment has been minimized.
This comment has been minimized.
|
So it sounds like the original issue is fixed! Thanks @m4b and @chicoxyzzy! |
m4b commentedNov 3, 2016
I receive compile errors w.r.t. invalid wasm being generated unless I turn off the
archiveandmach64features in goblin.Dump:
is what I receive after it outputs an inappropriately large s-expression to stdout.
Also, it looks like file access is broken (maybe this never worked, in which case shouldn't it throw unsupported function?):
If I print the path, it is correct; it just can't find any files seemingly. Testing with simple crate with file access has similar results.