diff options
author | Elias Naur <mail@eliasnaur.com> | 2019-04-08 23:12:52 +0200 |
---|---|---|
committer | Elias Naur <mail@eliasnaur.com> | 2019-04-10 14:21:20 +0000 |
commit | eddb41eb2cb7699f3515a229ff069ca914c7c879 (patch) | |
tree | d8c9247457ff5959b5525f32dff74f4fa45580f5 /src/runtime/asm_386.s | |
parent | 9a0a150c9f50f920f35cc4d50ac3005503f44f2d (diff) | |
download | go-eddb41eb2cb7699f3515a229ff069ca914c7c879.tar.gz go-eddb41eb2cb7699f3515a229ff069ca914c7c879.zip |
runtime: correct the TLS base offset on Android
CL 170955 set tlsg to the Android Q free TLS slot offset in the linker
data (16 on amd64, 8 on 386), offsetting all TLS relative access.
We need the 0'th slot (TLS_SLOT_SELF) at initialization, so
compensate with a corresponding negative offset.
Fixes the android/386 and android/amd64 builders broken by CL 170955.
Change-Id: I9882088c0c8bc6a777d2aabc9404cb76f02b6cea
Reviewed-on: https://go-review.googlesource.com/c/go/+/170956
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/runtime/asm_386.s')
-rw-r--r-- | src/runtime/asm_386.s | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index 61aae47c08..682f1ab5d0 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -172,8 +172,10 @@ nocpuinfo: TESTL AX, AX JZ needtls #ifdef GOOS_android - MOVL 0(TLS), BX - MOVL BX, 12(SP) // arg 4: TLS base, stored in the first slot (TLS_SLOT_SELF). + // arg 4: TLS base, stored in slot 0 (Android's TLS_SLOT_SELF). + // Compensate for tls_g (+8). + MOVL -8(TLS), BX + MOVL BX, 12(SP) MOVL $runtimeĀ·tls_g(SB), 8(SP) // arg 3: &tls_g #else MOVL $0, BX |