bernhard added a comment.

> It's for users who want smaller wasm binaries. It's not currently documented, 
> though yes, it would be nice to document it.

But how would a user even end up with wasm-opt in the same directory of clang 
binaries?

> Clang and wasm-ld are free to do anything wasm-opt does. Could you describe 
> what you want to do in more detail? It may be possible to find alternative 
> approaches, or to design a feature for it with a clear and documentable scope.

I'm generating additional data segments which while doing so increases the 
initial memory pages count and shifts any globals that point to __heap_base and 
global[0] (stack ptr init).

Due to memory-packing the end of data becomes ambiguous (-export=__data_end 
would mitigate that but it's nice to be compatible with any un-opt'ed wasm 
file), and due to simplify-globals with remove-unused-module-elements the 
global[0] can get copied/moved directly into the code section.
I am aware that this treads very much in undocumented assumptions, it is still 
experimental but it works. This hidden execution of wasm-opt is mostly making 
documentation on my end a bit harder.

If wasm-ld were to do these passes on its own I think there would at least be 
options passable with -Xlinker to make it not do that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70500/new/

https://reviews.llvm.org/D70500



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to