[lld][WebAssembly] Allow use of statically allocated TLS region.
It turns out we were already allocating static address space for TLS data along with the non-TLS static data, but this space was going unused/ignored. With this change, we include the TLS segment in `__wasm_init_memory` (which does the work of loading the passive segments into memory when a module is first loaded). We also set the `__tls_base` global to point to the start of this segment. This means that the runtime can use this static copy of the TLS data for the first/primary thread if it chooses, rather than doing a runtime allocation prior to calling `__wasm_init_tls`. Practically speaking, this will allow emscripten to avoid dynamic allocation of TLS region on the main thread. Differential Revision: https://reviews.llvm.org/D126107
Loading
Please sign in to comment