-
Notifications
You must be signed in to change notification settings - Fork 13.3k
binaryen fails to validate wasm in asm2wasm #37555
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
Comments
Potentially unwinding related? |
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. |
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 works as expected when linked/compiled with
|
@m4b alternatively you can clone this fork of Node.js, switch to |
@chicoxyzzy good to know! I just realized I think we can force the |
So it sounds like the original issue is fixed! Thanks @m4b and @chicoxyzzy! |
Based on an idea from <rust-lang/rust#37555>. It didn't make it work... but it doesn't appear to have made it _worse_. So I'm just going to leave this here and then check back in later.
I receive compile errors w.r.t. invalid wasm being generated unless I turn off the
archive
andmach64
features 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.
The text was updated successfully, but these errors were encountered: