sbc100 added a comment.

In D70500#1999934 <https://reviews.llvm.org/D70500#1999934>, @bernhard wrote:

> > 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 think the way to embed data blobs in your final binary is to pass them to the 
linker as inputs.  There are various techniques listed here: 
https://csl.name/post/embedding-binary-data/.   I imagine not all them them 
will work with today's toolchain but we should strive to make those approaches 
work where possible.

> 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



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

Reply via email to