[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
Fri Aug 1 13:49:01 PDT 2025


sbc100 wrote:

Note that you will still need to call `__wasm_init_tls` on all threads, including the main thread because this function also calls `__wasm_apply_tls_relocs`.   This would need to be called on all threads including the main thread, but it cannot be part of the start function and (like `__wasm_apply_data_relocs` can only be called once all symbols are resolved).  

I suppose we could have `__wasm_apply_data_relocs` call `__wasm_apply_tls_relocs` on the assumption that `__tls_base` has been set by then... but that would require a bunch of refactoring.  I'm not sure its worth it.

I assume you are calling `__wasm_apply_data_relocs` somewhere in your dynamic linker?

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


More information about the llvm-commits mailing list