From a5cb76243af54a6729f5668317fb87baa242b9cc Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Wed, 2 Sep 2015 11:23:15 +1200 Subject: cmd/internal/obj, cmd/link, runtime: lots of TLS cleanup It's particularly nice to get rid of the android special cases in the linker. Change-Id: I516363af7ce8a6b2f196fe49cb8887ac787a6dad Reviewed-on: https://go-review.googlesource.com/14197 Run-TryBot: Michael Hudson-Doyle TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/runtime/asm_arm64.s | 4 ++-- src/runtime/tls_arm.s | 3 --- src/runtime/tls_arm64.s | 3 --- src/runtime/tls_ppc64x.s | 6 ++++-- 4 files changed, 6 insertions(+), 10 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index 797c95eaba..2f2d8ca43d 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -36,9 +36,9 @@ TEXT runtime·rt0_go(SB),NOSPLIT,$0 MRS_TPIDR_R0 // load TLS base pointer MOVD R0, R3 // arg 3: TLS base pointer #ifdef TLSG_IS_VARIABLE - MOVD $runtime·tls_g(SB), R2 // arg 2: tlsg + MOVD $runtime·tls_g(SB), R2 // arg 2: &tls_g #else - MOVD $0x10, R2 // arg 2: tlsg TODO(minux): hardcoded for linux + MOVD 0, R2 // arg 2: not used when using platform's TLS #endif MOVD $setg_gcc<>(SB), R1 // arg 1: setg MOVD g, R0 // arg 0: G diff --git a/src/runtime/tls_arm.s b/src/runtime/tls_arm.s index 4ff0ae4ccc..00ca46993f 100644 --- a/src/runtime/tls_arm.s +++ b/src/runtime/tls_arm.s @@ -58,9 +58,6 @@ TEXT runtime·load_g(SB),NOSPLIT,$0 // See save_g MRC 15, 0, R0, C13, C0, 3 // fetch TLS base pointer BIC $3, R0 // Darwin/ARM might return unaligned pointer - // $runtime.tlsg(SB) is a special linker symbol. - // It is the offset from the TLS base pointer to our - // thread-local storage for g. MOVW runtime·tls_g(SB), R11 ADD R11, R0 MOVW 0(R0), g diff --git a/src/runtime/tls_arm64.s b/src/runtime/tls_arm64.s index a5f86c4199..f31a16b202 100644 --- a/src/runtime/tls_arm64.s +++ b/src/runtime/tls_arm64.s @@ -53,8 +53,5 @@ nocgo: RET #ifdef TLSG_IS_VARIABLE -// The runtime.tlsg name is being handled specially in the -// linker. As we just need a regular variable here, don't -// use that name. GLOBL runtime·tls_g+0(SB), NOPTR, $8 #endif diff --git a/src/runtime/tls_ppc64x.s b/src/runtime/tls_ppc64x.s index fc1718f508..127e7024e2 100644 --- a/src/runtime/tls_ppc64x.s +++ b/src/runtime/tls_ppc64x.s @@ -30,7 +30,7 @@ TEXT runtime·save_g(SB),NOSPLIT,$-8-0 // $runtime.tlsg(SB) is a special linker symbol. // It is the offset from the start of TLS to our // thread-local storage for g. - MOVD $runtime·tlsg(SB), R31 + MOVD $runtime·tls_g(SB), R31 ADD R13, R31 // The actual TLS base is 0x7000 below R13 SUB $0x7000, R31 @@ -51,10 +51,12 @@ nocgo: // // NOTE: _cgo_topofstack assumes this only clobbers g (R30), and R31. TEXT runtime·load_g(SB),NOSPLIT,$-8-0 - MOVD $runtime·tlsg(SB), R31 + MOVD $runtime·tls_g(SB), R31 // R13 is the C ABI TLS base pointer + 0x7000 ADD R13, R31 SUB $0x7000, R31 MOVD 0(R31), g RET + +GLOBL runtime·tls_g+0(SB), TLSBSS, $8 -- cgit v1.3