Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

docs(android): the floor is 29 because of ELF TLS, and the code now agrees

esengine552c670cef78
diff --git a/native/android/host/AndroidManifest.xml.in b/native/android/host/AndroidManifest.xml.in
index 787912588..420811453 100644
--- a/native/android/host/AndroidManifest.xml.in
+++ b/native/android/host/AndroidManifest.xml.in
@@ -18,6 +18,19 @@
`__builtin_available` out and turns its symbol into a load-time requirement.
Built at android-33, the released host could not dlopen below API 31 —
"cannot locate symbol APerformanceHint_getManager" on Android 10 and 11.
+
+ 29 is also where ELF TLS begins, and that is the reason the floor cannot go
+ lower by guarding more calls. Built at or above 29, every thread_local in the
+ host and in Dawn resolves through __tls_get_addr@LIBC_Q, a versioned symbol
+ no older loader has — the .so does not load below 29, whatever the manifest
+ promises. Built below 29, the compiler lowers ALL of it to emulated TLS
+ instead, and that build is not the same renderer: Dawn compiled at
+ android-24 drew postprocess-effects as one flat black frame on the API 34
+ emulator while thirteen other examples were bit-identical (v0.41.0's smoke;
+ exp/dawn-android-api29 isolated the variable — the two builds' import tables
+ differ in nothing but the TLS mechanism). Android 7-9 support therefore means
+ shipping and separately verifying an emulated-TLS build, not loosening this
+ number.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="@APP_ID@"
diff --git a/native/host/platform/android.cpp b/native/host/platform/android.cpp
index f24eeeda4..a729c6e19 100644
--- a/native/host/platform/android.cpp
+++ b/native/host/platform/android.cpp
@@ -644,18 +644,9 @@ struct FrameDriver {
void post() {
if (!choreographer || posted || !running) return;
posted = true;
- if (__builtin_available(android 29, *)) {
- AChoreographer_postFrameCallback64(choreographer, &FrameDriver::onVsync64, this);
- } else {
- // Deprecated in 29 and the only one that exists below it. minSdk is 26,
- // so this branch is the two releases the 64-bit call cannot serve — not
- // an oversight, which is why the warning is turned off rather than the
- // call changed.
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- AChoreographer_postFrameCallback(choreographer, &FrameDriver::onVsync32, this);
-#pragma clang diagnostic pop
- }
+ // The 64-bit callback is API 29, which is the floor (see the manifest
+ // template for why the floor cannot go lower).
+ AChoreographer_postFrameCallback64(choreographer, &FrameDriver::onVsync64, this);
}
private:
@@ -671,7 +662,6 @@ private:
}
static void onVsync64(int64_t, void* data) { static_cast<FrameDriver*>(data)->tick(); }
- static void onVsync32(long, void* data) { static_cast<FrameDriver*>(data)->tick(); }
};
FrameDriver g_frames;