You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
of the test files, only call does not have memory initializer. I'd like to see it implemented, or at least stubbed out, so I can examine the object files produced.
RUST_BACKTRACE=1 cargo run --bin wasm2obj -- memory.wasm -o memory.o
Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
Running `target/debug/wasm2obj memory.wasm -o memory.o`
%wasm_0x0(0): relocs: []
error: FIXME: implement data initializers
How much work would it be to implement this, or at least add stubs so it doesn't stop the entire binary emission process?
I just pushed a patch which writes wasm data initializers into faerie data sections. Wasm data initializers have some special semantics that involve more than just prepopulating the contents of a .data section, but if you're just testing object file writing, you don't need to worry about that for now.
I expect that for the stuff you're doing, llvm2cretonne will be a better vehicle for exploration than the wasm stuff, because wasm needs special handling in lots of areas. Also, you can directly compare the output with LLVM's own output from llc -filetype=obj test.ll. It looks like faerie is doing what LLVM calls -function-sections and -relocation-model=pic, though I haven't looked into why the relocation for zero is different.
Wowwwww this is so cool ! How many translators does cretonne have ?
And yes I’m definitely doing PIC and function sections (afaics function sections is only applicable to ELF and not mach-o)
At some point could make it do non PIC but I dunno if it’s worth the effort as it’s becoming niche. And also need to get other than X86 relocations working 😆
The wasm ones and the llvm2cretonne prototype are the most complete frontends at the moment. There are a few others that have started, but aren't usable yet.
And yeah, PIC and function sections are definitely the way to go for now.
Re zero relocation, i would have to investigate but my guess is your compiler was very clever and added a relative relocation to the locally defined function so as to avoid routing a callq through the plt table, OR it’s just a bug in faerie ;)
Unfortunately I suspect it’ll be difficult for me to get the llvm-sys crate working, I always have llvm lib linking difficulties on my computer... hopefully will be fine, will try tonight !
EDIT
I got it working; had to pass RUSTFLAGS=-ltinfo to get llvm to link on my system, otherwise i get linker errors for symbols from that lib. Also I dunno how that works, since I figured I would require something like -C link-args=ltinfo but yea, it did its thing...
Activity
sunfishcode commentedon Nov 4, 2017
I just pushed a patch which writes wasm data initializers into faerie data sections. Wasm data initializers have some special semantics that involve more than just prepopulating the contents of a .data section, but if you're just testing object file writing, you don't need to worry about that for now.
m4b commentedon Nov 4, 2017
Awesome, got it! Yup, I'm just examining the object files and primarily grepping them / gdb disass, and eventually will try to link.
sunfishcode commentedon Nov 6, 2017
I've now hooked up faerie support in the new llvm2cretonne prototype, including relocations:
I expect that for the stuff you're doing, llvm2cretonne will be a better vehicle for exploration than the wasm stuff, because wasm needs special handling in lots of areas. Also, you can directly compare the output with LLVM's own output from
llc -filetype=obj test.ll. It looks like faerie is doing what LLVM calls-function-sectionsand-relocation-model=pic, though I haven't looked into why the relocation forzerois different.m4b commentedon Nov 6, 2017
Wowwwww this is so cool ! How many translators does cretonne have ?
And yes I’m definitely doing PIC and function sections (afaics function sections is only applicable to ELF and not mach-o)
At some point could make it do non PIC but I dunno if it’s worth the effort as it’s becoming niche. And also need to get other than X86 relocations working 😆
sunfishcode commentedon Nov 6, 2017
The wasm ones and the llvm2cretonne prototype are the most complete frontends at the moment. There are a few others that have started, but aren't usable yet.
And yeah, PIC and function sections are definitely the way to go for now.
m4b commentedon Nov 6, 2017
Re zero relocation, i would have to investigate but my guess is your compiler was very clever and added a relative relocation to the locally defined function so as to avoid routing a callq through the plt table, OR it’s just a bug in faerie ;)
Unfortunately I suspect it’ll be difficult for me to get the llvm-sys crate working, I always have llvm lib linking difficulties on my computer... hopefully will be fine, will try tonight !
EDIT
I got it working; had to pass
RUSTFLAGS=-ltinfoto get llvm to link on my system, otherwise i get linker errors for symbols from that lib. Also I dunno how that works, since I figured I would require something like-C link-args=ltinfobut yea, it did its thing...[-]Implement memory initializers[/-][+]wasm2obj: Implement memory initializers[/+]Compile a simple function (#2)
Fuzzing: Add test case logging and regression test template
Fix 16-bit x86_pextr encoding
Add some (incomplete set) basic sanity end-to-end tests (bytecodealli…
Update #2 - Still incomplete. Iterate on naming convention and lowering.
Update #2 - Still incomplete. Iterate on naming convention and lowering.
Update #2 - Still incomplete. Iterate on naming convention and lowering.
Update #2 - Still incomplete. Iterate on naming convention and lowering.
akirilov-arm commentedon Sep 10, 2021
@alexcrichton Since you removed
wasm2objin PR #3301, I suppose this is no longer relevant 😄?alexcrichton commentedon Sep 11, 2021
Indeed!
Fix fuzz (bytecodealliance#35)
Fix a spelling error in a comment for the Example (bytecodealliance#2)
fix spelling issue bytecodealliance#2
Add tests for wasi-http to test-programs (bytecodealliance#2)
bump new deps to latest releases (bytecodealliance#3)
Begin implementation of wasi-http (#5929)
Merge pull request #2 from dhil/wasmfx
Start to port Wasmtime to the new wasi-io API with resources. (#7029)
Merge upstream changes that have occurred since the fork (bytecodeall…
Merge pull request #2 from radu-matei/update-wasmtime
Cranelift: Optimize out redundant select + icmp instructions (#12135)
RR #2: Sha256 checksum for components (#12576)