From 1d10b17589ce651caeb0841b2312065ee44f800d Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 28 Mar 2019 13:11:53 +0100 Subject: cmd/link/ld,cmd/internal/obj,runtime: make the Android TLS offset dynamic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We're going to need a different TLS offset for Android Q, so the static offsets used for 386 and amd64 are no longer viable on Android. Introduce runtime·tls_g and use that for indexing into TLS storage. As an added benefit, we can then merge the TLS setup code for all android GOARCHs. While we're at it, remove a bunch of android special cases no longer needed. Updates #29674 Updates #29249 (perhaps fixes it) Change-Id: I77c7385aec7de8f1f6a4da7c9c79999157e39572 Reviewed-on: https://go-review.googlesource.com/c/go/+/169817 TryBot-Result: Gobot Gobot Reviewed-by: Cherry Zhang --- src/runtime/sys_linux_amd64.s | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/runtime/sys_linux_amd64.s') diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index b709f77060..5c300f553d 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -605,10 +605,8 @@ TEXT runtime·sigaltstack(SB),NOSPLIT,$-8 // set tls base to DI TEXT runtime·settls(SB),NOSPLIT,$32 #ifdef GOOS_android - // Same as in sys_darwin_386.s:/ugliness, different constant. - // DI currently holds m->tls, which must be fs:0x1d0. - // See cgo/gcc_android_amd64.c for the derivation of the constant. - SUBQ $0x1d0, DI // In android, the tls base + // Android stores the TLS offset in runtime·tls_g. + SUBQ runtime·tls_g(SB), DI #else ADDQ $8, DI // ELF wants to use -8(FS) #endif -- cgit v1.3-5-g9baa