Comments (5)
We only support THREAD_MODEL = single
at this time. I don't know everything that would be required to get the posix model to work, but @sunfishcode likely wold.
from wasi-libc.
Building with THREAD_MODEL=posix would mean the resulting binary would only be runnable on the VM that supports the threads proposal: https://github.com/WebAssembly/threads.
Currently the only place I know that that is supported by default is in chrome or chromium-derived browsers.
Presumably as well as THREAD_MODEL=posix you would also want access to a pthreads library which wasi-sdk/wasi-libc doesn't currently provide and some low level syscalls for thread creation and destruction which are not currently part of WASI.
Having said all that, perhaps you don't actually required threads, and in this case I don't see why llvm shouldn't be able to lower away TLS accesses just like does atomics. I actually a little surprised that it doesn't.
from wasi-libc.
I believe wasm backend in LLVM 8 doesn't have TLS support; it was added in LLVM 9. And also, as others have noted, THREAD_MODEL = posix
is not fully implemented in wasi-libc yet. We'd like to support it, and some parts are done, but there's more work to be done. And also, yes, to be useful outside of environments like browsers which already have threads, we'll need additional WASI APIs for threat management.
from wasi-libc.
@Shillaker, are you looking for threading support or would you be OK the compiler simply compiling TLS to regular global data (i.e. better support THREAD_MODEL = single)?
For the later it sounds like you could try LLVM 9. For the former, there is more work do be done.
from wasi-libc.
Thanks for the quick and detailed responses. Sorry I should have been clearer before, the answer is more the latter. I'm doing some research for which I'd like to compile some legacy pthread-based code to wasm and produce a binary that makes all the "normal" thread-related syscalls. As a result I don't need a compliant VM, just something that compiles. I didn't know about the LLVM 9 TLS support so I'll have a play with that and try to include standard pthreads from musl. Thanks again for the info, very much appreciated!
from wasi-libc.
Related Issues (20)
- Adding `IFTODT` for more compatibility HOT 1
- A few packaging nits, coming from Nixpkgs/NixOS HOT 6
- Confusion around SIGCHLD value? HOT 2
- WASI signal numbers out of sync with wasi-libc signal numbers HOT 15
- Latest SIMD patch HOT 2
- fd_set implementation is inefficient HOT 5
- Support for `accept{,4}` HOT 3
- Implement the new preopen scheme in wasi-libc HOT 1
- __wasm_call_ctors broken previously wokring rust wasm reactors HOT 2
- getpagesize() HOT 4
- README seems to be wrong wrt minimal LLVM version HOT 4
- Provide socket option definitions HOT 3
- Missing __WASI_RIFLAGS_RECV_DATA_TRUNCATED for MSG_TRUNC HOT 1
- help how to disable feature for example( bulk memory)? HOT 1
- Humble request from distro packagers to start releasing versions HOT 6
- poll() with timeout fails with "timer subscriptions only support monotonic timer" HOT 1
- dlmalloc has license incompatible with Fedora policies HOT 12
- Migrate build system to CMake HOT 4
- How to distribute `THREAD_MODEL=posix` builds? HOT 46
- Is it safe to have mixed sbrk and malloc calls? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasi-libc.