Use ELF TLS by default instead of emulated TLS for Android build targets when the API level is >= 29.
Android Q features full TLS support. See release notes here and implementation details here.
(This is an updated https://reviews.llvm.org/D63904)
Differential D147849
[Android] Use ELF TLS for Android API level 29+ brad on Apr 8 2023, 4:40 AM. Authored by
Details Use ELF TLS by default instead of emulated TLS for Android build targets when the API level is >= 29. Android Q features full TLS support. See release notes here and implementation details here. (This is an updated https://reviews.llvm.org/D63904)
Diff Detail
Event TimelineComment Actions +1, but I'd like @rprichard to be the one to actually sign off since he'll be the one to know if there are any caveats. Comment Actions nit: In the description/commit message, the "when the API level is > 29" should be "when the API level is >= 29". I think it's OK, but I'd like confirmation that it works with LTO? One issue I noticed earlier was that the compiler flag (-f[no-]emulated-tls) doesn't work with LTO:
This link-time LTO setting can be changed using -Wl,-plugin-opt,-emulated-tls={0,1}. It's not clear to me from the patch whether the new default applies when -flto is used to compile. (I suspect that it does, but a confirmation might be useful?) Also: This is technically an ABI break, but it only applies when a thread-local variable is accessed across an ABI boundary, which seems unlikely/rare. It seems like the change is worth it, in any case. Comment Actions does https://reviews.llvm.org/D147834 fix this?
Comment Actions Thanks, I hadn't seen that before. Yes, that should make -f[no-]emulated-tls work with LTO. Comment Actions I'm not in a rush to commit this, it would be nice if at least one other person could Ok this. |