-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Support llvm::TargetOptions::EmulatedTLS
#16177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support llvm::TargetOptions::EmulatedTLS
#16177
Conversation
The implementation doesn't reuse LLVMTargetMachineOptions that is a private type. It instead inlines the different setter methods and directly calls `llvm::Target::createTargetMachine()`.
This includes Android, OpenBSD and MinGW.
This must be added to LLVM upstream first. The most recent LLVM major release must never require In this case the upstream C function signature would be |
But then What's the problem with compiling crystal with a custom LLVM binding? I mean, both Rust and Zig do it, and we don't care about the missing |
This reverts commit f7629d9.
After many years we've finally be able to get rid of the I wouldn't want to bring it back as an expected general build requirement just like that. It nullifies all the effort spent on simplifying the build process. |
I pushed a PR to LLVM: llvm/llvm-project#161155
The feature also won't be available without LLVM X (while at least LLVM 13+ supports it). I'm not fond of custom bindings, but truth is that the LLVM-C API is lagging by many years behind the C++ API. With a custom binding we'd enable the feature today and be compatible with LLVM 13+ (at least), and we can still push patches upstream in parallel. We also never got rid of llvm ext: it's still required whenever compiling for LLVM < 18 (e.g. macOS) and the support is still there on every target with the exception of the CI configuration for Windows. |
Superseded by #16178. |
Adds support for the
llvm::TargetOptions::EmulatedTLS
setting that is only available through the C++ API. This patch implements a custom alternative toLLVMCreateTargetMachine
which requires to always compilesrc/llvm/llvm_ext.o
again 😞Emulated TLS is now always set for Android, OpenBSD and MinGW, which should in turn make the
@[ThreadLocal]
annotation portable 🤞TODO:
Closes #16176.