[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 12:28:28 PDT 2020


bernhard added a comment.

> Would it work to increase the memory size, and then put your data in the new space this creates at the end of memory?



> `__data_end` and `__heap_base` aren't things you can move around once the linker has defined them. Their values can be baked in elsewhere in the wasm module, so it's not safe in general to insert new memory in between them and shift things around.

My plan was to embed arbitrary sized files directly into the data memory after the wasm file was created. But I think you're right, it ends up only working with simple wasm programs, more complex code crashes somewhere during `__wasm_call_ctors` with the approach I took.

I guess custom sections would be the official route but I was hoping to avoid having to pass the entire data through JavaScript before it reaches WASM land.

Also I'm very sorry to have hijacked this patch discussion with something very different. If you have some more hints for me how I could accomplish this I'd very gladly hear them, but if this is the wrong place we should probably leave it at that. Thank you for your time!


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