LLVM JIT needs to be able to use emulated TLS on all platforms, and this provides a reference one can compile to enable emutls for Linux/Mac/Windows.
Details
- Reviewers
chh howard.hinnant hans - Commits
- rG922b602683fe: [builtins] Implement emulated TLS on Windows.
rG5de7f2d7b8e9: [builtins] Implement emulated TLS on Windows.
rCRT301350: [builtins] Implement emulated TLS on Windows.
rCRT301089: [builtins] Implement emulated TLS on Windows.
rL301350: [builtins] Implement emulated TLS on Windows.
rL301089: [builtins] Implement emulated TLS on Windows.
Diff Detail
- Repository
- rL LLVM
Event Timeline
I don't know if the WIN32 definitions are correct or not.
The non-WIN32 change looked good and compatible with current definitions.
To get commit access, please see http://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access
Someone should have tested this on _WIN32.
lib/builtins/emutls.c | ||
---|---|---|
204 ↗ | (On Diff #96488) | It's not about compiler-rt; Clang defines __ATOMIC_ACQUIRE et al. as built-in macros: https://clang.llvm.org/docs/LanguageExtensions.html#c11-atomic-builtins Same thing with the __atomic_load_n and store_n functions. GCC also provides these macros and functions. Probably it's better to just guard on #if !defined(__ATOMIC_RELEASE). But shouldn't you also define the macros in a compatible way? I.e. shouldn't __ATOMIC_ACQUIRE be 2 and _RELEASE be 3? With your enum they'll be 0 and 1. |
lib/builtins/emutls.c | ||
---|---|---|
204 ↗ | (On Diff #96488) | I'm not sure matching the enum values is that important as each function is used once. |
compiler-rt/trunk/lib/builtins/emutls.c | ||
---|---|---|
105 | Was there any specific reason for including immintrin.h here? I don't see anything below that would require it. It breaks cross compilation for windows on non-x86 architectures (ARM), and simply skipping the include fixes the build, so I don't think it's needed on x86 either? |
compiler-rt/trunk/lib/builtins/emutls.c | ||
---|---|---|
105 | It's for the atomic load/store operations arround line 200. |
compiler-rt/trunk/lib/builtins/emutls.c | ||
---|---|---|
105 | I see - thanks for clarifying! |
Was there any specific reason for including immintrin.h here? I don't see anything below that would require it. It breaks cross compilation for windows on non-x86 architectures (ARM), and simply skipping the include fixes the build, so I don't think it's needed on x86 either?