Stream: wasmtime

Topic: updating offsets


view this post on Zulip julia (Nov 04 2022 at 17:29):

I am updating data in data section when wasmtime is parsing and validating wasm module using wasmparser. But this updating changes the length of the data and so I need to update all offsets in the functions. Is there a way to do it in wasmtime or not?

view this post on Zulip Lann Martin (Nov 04 2022 at 17:44):

I could be mistaken, but that doesn't sound plausible generally.

view this post on Zulip Lann Martin (Nov 04 2022 at 17:45):

(deleted)

view this post on Zulip julia (Nov 04 2022 at 17:54):

Can I do that in compiler-level in Rustc to change the allocated length?

view this post on Zulip Lann Martin (Nov 04 2022 at 18:07):

Presumably :shrug:

view this post on Zulip bjorn3 (Nov 04 2022 at 19:56):

You need to do it before linking. After linking the relocation information necessary for this is lost.

view this post on Zulip julia (Nov 05 2022 at 02:24):

@bjorn3 can you please explain it more? How can I do it before linking?

view this post on Zulip bjorn3 (Nov 05 2022 at 14:09):

You can pass -Csave-temps to rustc to save all temporary unlinked object files. You can then edit those using the information in the linking section and then run the linker command that rustc would normally use to produce the final executable wasm module.


Last updated: Dec 23 2024 at 13:07 UTC