WebAssembly / tool-conventions

Conventions supporting interoperatibility between tools working with WebAssembly.
Artistic License 2.0
297 stars 65 forks source link

Document relationship between TLS and bulk memory #184

Closed penzn closed 2 years ago

penzn commented 2 years ago

In D130053 @sbc100 pointed out that LLVM needs bulk memory for TLS support, because that is how TLS segments are emitted as weak segments and require memory.init.

I don't know if it is going to be possible to implement TLS without bulk memory, say less efficiently. This might need to be documented here - Linking.md has a section on TLS and threads, but it doesn't say anything about bulk memory.

sbc100 commented 2 years ago

Regarding building an alternative: I think that while it might be possible to do TLS via memcpy() instead of memory.init, its almost certainly not worth the effort because the intersections of engines that support threads and engines that don't support bulk memory is likely to be empty.

In fact bulk-memory is about it be enabled by default in llvm: https://reviews.llvm.org/D125728

penzn commented 2 years ago

Turns out there is a description in Linking.md, I got confused by the "TLS to MVP" section. I've opened a PR to move those sections together (somehow I can't request reviews).

dschuff commented 2 years ago

I invited you to join the WebAssembly Github organizatoin. I think that should allow you to request reviews.

penzn commented 2 years ago

Thank you, accepted the invite! It doesn't look like I can request yet though.