aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_amd64.s
diff options
context:
space:
mode:
authorElias Naur <mail@eliasnaur.com>2019-03-28 13:11:53 +0100
committerElias Naur <mail@eliasnaur.com>2019-03-29 17:16:32 +0000
commit1d10b17589ce651caeb0841b2312065ee44f800d (patch)
tree5ac85df676c80f4a0fdf4aa507ef4ecab9d90e5c /src/runtime/sys_linux_amd64.s
parent2cc347382f4df3fb40d8d81ec9331f0748b1c394 (diff)
downloadgo-1d10b17589ce651caeb0841b2312065ee44f800d.tar.xz
cmd/link/ld,cmd/internal/obj,runtime: make the Android TLS offset dynamic
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 <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/runtime/sys_linux_amd64.s')
-rw-r--r--src/runtime/sys_linux_amd64.s6
1 files changed, 2 insertions, 4 deletions
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