[PATCH] D70500: [WebAssembly] Enable use of wasm-opt and LTO-enabled system libraries

bernhard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 23 08:38:26 PDT 2020


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





More information about the cfe-commits mailing list