This is necessary for enabling LSAN on Android (D89251) because:
- LSAN will have false negatives if run with emulated-tls.
- Bionic ELF-TLS is not compatible with Gold (hence the need for LLD)
oontvoo on Fri, Oct 16, 11:08 PM.Authored by
Maybe I misunderstood the question, but this is exactly what this patch is trying to do.
(We can't switch to ELF TLS unless we know Bionic supports it. The idea is the build would set this ANDROID_HAS_ELF_TLS variable when building for Q+ )
It seems to me that ideally the NDK clang should be defaulting to -fno-emulated-tls for android with a new enough target platform version, and should also be defaulting to use lld. I think that's been the plan for a while -- do you know if it's going to actually happen soon?
That might then make some of these changes unnecessary.
@danalbert to make sure I don't mix this up. https://android.googlesource.com/platform/ndk/+/master/docs/Roadmap.md#ndk-r22 shows that NDK r22 (which is going to beta soon) does indeed change the default linker to LLD. For TLS, this is indeed sensitive to target API, and Android will still be targeting those older APIs for quite some time (so we can't just remove support for them).
The bot needs to use ndk22. It's using 16.
Sorry, I'm not sure which changes you'd like to be split.