Open alexcrichton opened 2 hours ago
That does seem wrong. Just to confirm, if you compile to and object file (not a .bc file) this doesn't fail?
Right yeah, this works ok:
$ llc wat.ll -filetype=obj -o foo.o -mcpu=mvp
$ wasm-ld foo.o -o foo.wasm --no-entry --export foo
$ wasm-tools validate -f=-reference-types foo.wasm
Interestingly the -mcpu=mvp
is required though. If I remove that flag then it additionally doesn't work. I forget all the ways that the CPU and such can be configured in LLVM, but I believe that passing -mcpu=mvp
mirrors what the Rust compiler does at least. (I'm mostly not sure how the CLI flag -mcpu=mvp
interacts with the "target-cpu"="mvp"
attribute on functions)
@llvm/issue-subscribers-lld-wasm
Author: Alex Crichton (alexcrichton)
Given this input:
Locally I see:
This issue is a reduction of https://github.com/rust-lang/rust/issues/130604 and is where a user is trying to disable reference types for their entire compilation and use LTO as well, but it looks like the
"target-cpu"
isn't taking effect withwasm-ld
.cc @sbc100 do you know what might be causing this?