Closed TroutZhang closed 1 week ago
Here is the PR for upstream: https://github.com/mjansson/rpmalloc/pull/347
How does this interact with previous Android SDKs, where the change was not needed?
My colleague uses tracy for profiling on Android, and we recently upgraded ndk from 25c to 27c, today when enabling tracy, the build will crash, hence the fix.
How does this interact with previous Android SDKs, where the change was not needed?
It seems previously the emulated TLS doesn't give error at all.
Ah, it shouldn't matter, there are ifdefs against the SDK and NDK version.
My local fix is like the below:
#if defined(__ANDROID__) && __ANDROID_API__ >= 29 && defined(__NDK_MAJOR__) && __NDK_MAJOR__ >= 26
#define TLS_MODEL __attribute__((tls_model("local-dynamic")))
#else
#define TLS_MODEL
#endif
Ah, it shouldn't matter, there are ifdefs against the SDK and NDK version.
Yes, it should be empty, but since the code works just as is, so I didn't change much.
Basically, only one of our games, that has minSdk 29, triggered this. Others are fine when ndk 25c => 27c.
So, only ndk 26+ and minSdk 29+ will enable hardware ELF TLS, hence the crash in dlopen from Java's System.loadLibrary
For android ndk, it is always a dynamic .so to let java load. So "initial-exec" would either not work, or crash for ndk 26+ with minSdk 29+.
check here: https://github.com/android/ndk/wiki/Changelog-r26#changes
Issue 1679: Clang will now automatically enable ELF TLS for minSdkVersion 29 or higher.