-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Clang compiling to WebAssembly with multivalue and wasm-opt fails #60613
Comments
@llvm/issue-subscribers-backend-webassembly |
I think the expect behaviour is that the "target-features" section of the binary should include "multi-value". This should be enough to inform wasm-opt about the features to enable. |
@fluffyball9, can you share a clang driver command that reproduces the issue? I wonder if this is caused by the target features section being stripped somehow. |
The simplest arguments that reproduces the issue are |
If I run clang with
|
That features section correctly contains "multivalue". @fluffyball9, what version of wasm-opt do you have in your path? Can you run |
@tlively I'm using wasm-opt version 112. After linking, it seems like the features section is removed. |
This seems to work for me. test.c:
Compiling with: Finishes with no error, and I verified that it ran wasm-opt. Can you provide a complete reproducer? |
Ah, I noticed that it had optimized |
Ok, so the problem is that the |
(did you mean |
I confirmed that |
To me that would seem to contradict that meaning of I guess that it might be more ergonomic just to never strip the target-features section, but what if I'm a user who actually wants to pass How about this: Clang can detect if its going to run wasm-opt after wasm-ld and in that case inject some kind of flag (perhaps a new |
Yeah, I guess it's the driver's job to manage the tool pipeline, including any flags that affect post-link opt, so moving the logic to the driver makes sense. I think |
@llvm/issue-subscribers-lld-wasm Author: None (fluffyball9)
Compiling to WebAssembly using clang with multivalue and wasm-opt on path build fails because clang doesn't automatically pass `--enable-multivalue` to wasm-opt. This parameter should be automatically passed to wasm-opt.
|
@llvm/issue-subscribers-clang-driver Author: None (fluffyball9)
Compiling to WebAssembly using clang with multivalue and wasm-opt on path build fails because clang doesn't automatically pass `--enable-multivalue` to wasm-opt. This parameter should be automatically passed to wasm-opt.
|
This flag causes wasm-ld preserve a section even in the face of `--strip-all`. This is useful, for example, to preserve the target_features section in the ase of clang (which can run wasm-opt after linking), and emcc (which performs a bunch of post-link work). Fixes: llvm/llvm-project#60613 Fixes: llvm/llvm-project#55781 Differential Revision: https://reviews.llvm.org/D149917
Compiling to WebAssembly using clang with multivalue and wasm-opt on path build fails because clang doesn't automatically pass
--enable-multivalue
to wasm-opt. This parameter should be automatically passed to wasm-opt.The text was updated successfully, but these errors were encountered: