-
Notifications
You must be signed in to change notification settings - Fork 192
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
unexpected false: Bulk memory operation (bulk memory is disabled) #254
Comments
The wasm binary generated by the linker should contain features section which contains bulk memory. I think the correct fix here is to pass |
I actually didn't know that Although since clang is running it, I'm not sure how to pass flags to it 🤔 Seems like it is run if Should this be a patch to llvm? 🤔 |
We could consider ways to make the automatic running of wasm-opt optional, or add extra flags, but I also think we might get push back if we try to add too much complexity there (e.g. use environment variables, or some kind of I think make wasm-opt read the features section by default is probably good way to fix the proximate issue, and as a very short term workaround you could remove wasm-opt from your |
There is a feature request for an opt out flag here: Personally, I'm not a fan of "do x if some random binary exists, otherwise do y", especially when there aren't any warnings printed. Upon learning that It seems like passing
|
What flags did you pass when running |
Ah, I do pass My goal is to have the smallest output so I'm passing Maybe it was a stroke of luck that I accidentally didn't run
The second case here is the same wasm-opt --enable-bulk-memory -O3 bcrypt.wasm -o bcrypt.wasm If I understand it correctly, it's the linker that invokes |
Its the clang driver, when running in link mode, that runs wasm-opt. However, the clang driver doesn't actually know about the features used since they could be embedded in object files. BTW, you can use |
Out of interest, how to the file sizes compare for you optimized and non-optimized builds? If wasm-opt doesn't give a win in either size or performance that would be very surprising. |
It gives a win in file size!
I did open an issue here WebAssembly/binaryen#5088, but then maybe the answer just is that |
Thanks for the tip! Do you know if there is any advantage to keeping the features sections in when shipping a wasm file intended to run under a specific runtime (Node.js) to users? |
The features section mostly exists tools further down the pipeline to read (e.g. wasm-opt). I don't know of any other reason to keep it around... I guess a node runtime could use it to set certain node flags (i.e. enable certain experimental features). |
This seems like a bad problem for anyone using |
Can clang run |
Not really.. the stripping is part of the linking process. Is |
I guess the clang driver could inject some kind of |
Because all it used to do was read the target features section, which is the default behavior anyway. It's a good thing it's deprecated because now we can reuse it and get the behavior we actually want. |
Oh I was confused.. I thought the target features section was being ignored... but it was actually being stripped. In that case I think the solution here is to have clang ask wasm-ld to keep this section if it knows its going to run wasm-opt. Are you talking about deriving features based on their usage? Can binaryen do that already? |
Yes, that's what I had in mind. But no, Binaryen can't already do that. |
Would be neat if (also, thanks everyone for the discussion here, I've learnt so much today ❤️) |
It seems like this should be an upstream issue on LLVM. @sunfishcode opened llvm/llvm-project#64909 to track this. I'll close this here and we can continue the discussion there. |
When upgrading from SDK 15 to 16, I'm running into the following problem whilst compiling a c file:
This is the command I'm running:
Here is a Dockerfile that can be used to reproduce this. As can be seen, this used to work with SDK 15:
LinusU/cwasm-lodepng@3d9ab53
I've tried to work around this for quite a while, but couldn't find anything that worked. I've tried passing
-mbulk-memory
to clang, which seems to change the error slightly, but still doesn't work. Any help, or pointers on what to Google, would be much appreciated!The text was updated successfully, but these errors were encountered: