Commit fc7ac2e8 authored by Elias Naur's avatar Elias Naur

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 <mail@eliasnaur.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 814c97b3
......@@ -50,7 +50,7 @@ inittls(void **tlsg, void **tlsbase)
void *handle, *get_ver;
// Check for Android Q where we can use the free TLS_SLOT_APP slot.
handle = dlopen(NULL, RTLD_LAZY);
handle = dlopen("libc.so", RTLD_LAZY);
if (handle == NULL) {
fatalf("inittls: failed to dlopen main program");
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment