Skip to content

Commit fc7ac2e

Browse files
committed
runtime/cgo: look for android_get_device_api_level in libc.so
The presence of the android_get_device_api_level symbol is used to detect Android Q or later. Use the suggestion by Ryan Prichard and look for it in libc.so and not in the entire program where someone else might have defined it. Manually tested on an Android Q amd64 emulator and arm64 Pixel. Updates #29674 Change-Id: Iaef35d8f8910037b3690aa21f319e216a05a9a73 Reviewed-on: https://go-review.googlesource.com/c/go/+/170127 Run-TryBot: Elias Naur <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 814c97b commit fc7ac2e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/cgo/gcc_android.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ inittls(void **tlsg, void **tlsbase)
5050
void *handle, *get_ver;
5151

5252
// Check for Android Q where we can use the free TLS_SLOT_APP slot.
53-
handle = dlopen(NULL, RTLD_LAZY);
53+
handle = dlopen("libc.so", RTLD_LAZY);
5454
if (handle == NULL) {
5555
fatalf("inittls: failed to dlopen main program");
5656
return;

0 commit comments

Comments
 (0)