aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_amd64.s
diff options
context:
space:
mode:
authorHyang-Ah Hana Kim <hyangah@gmail.com>2015-10-16 14:04:29 -0400
committerHyang-Ah Hana Kim <hyangah@gmail.com>2015-10-28 20:54:28 +0000
commitdfc8649854eeb569598cabfbc8e408c3ef07a539 (patch)
treee6bbdf35114f9c7382e5ce005d5fb7a5367ab2bc /src/runtime/sys_linux_amd64.s
parent80d9106487e451f5de5d4c4e5de97002c33a0363 (diff)
downloadgo-dfc8649854eeb569598cabfbc8e408c3ef07a539.tar.xz
runtime, cmd: TLS setup for android/amd64.
Android linker does not handle TLS for us. We set up the TLS slot for g, as darwin/386,amd64 handle instead. This is disgusting and fragile. We will eventually fix this ugly hack by taking advantage of the recent TLS IE model implementation. (Instead of referencing an GOT entry, make the code sequence look into the TLS variable that holds the offset.) The TLS slot for g in android/amd64 assumes a fixed offset from %fs. See runtime/cgo/gcc_android_amd64.c for details. For golang/go#10743 Change-Id: I1a3fc207946c665515f79026a56ea19134ede2dd Reviewed-on: https://go-review.googlesource.com/15991 Reviewed-by: David Crawshaw <crawshaw@golang.org>
Diffstat (limited to 'src/runtime/sys_linux_amd64.s')
-rw-r--r--src/runtime/sys_linux_amd64.s8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s
index df72a77afc..aed85cb0aa 100644
--- a/src/runtime/sys_linux_amd64.s
+++ b/src/runtime/sys_linux_amd64.s
@@ -371,8 +371,14 @@ 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
+#else
ADDQ $8, DI // ELF wants to use -8(FS)
-
+#endif
MOVQ DI, SI
MOVQ $0x1002, DI // ARCH_SET_FS
MOVQ $158, AX // arch_prctl