[lld] [WebAssembly] Generate a call to __wasm_apply_global_tls_relocs in __wasm_init_memory (PR #149832)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 28 12:51:38 PDT 2025


sbc100 wrote:

I'm hoping to get some more time to look into this soon.

My main concern is around the timing of application of relocations.   The dynamic linking scenario its generally not safe to apply relocations until all libraries have been loaded (i.e. all symbols have been resolved).   At last that is true for relocations in general.   Perhaps its true that TLS relocations always resolve to internal locations?   In which case this might be safe.

But this is the reason way `__wasm_apply_data_relocs` is never called from the wasm start function:  Symbol resolution is not necessarily complete when the start functions runs (i.e. when a given module is loaded).

https://github.com/llvm/llvm-project/pull/149832


More information about the llvm-commits mailing list