diff options
author | Michael Hudson-Doyle <michael.hudson@canonical.com> | 2015-09-02 10:35:54 +1200 |
---|---|---|
committer | Michael Hudson-Doyle <michael.hudson@canonical.com> | 2015-09-10 19:49:13 +0000 |
commit | b0344e9fd539256cffe630744311388aa94b0ecd (patch) | |
tree | cabbf22854d9f2d6179d107415eb9ab6c61bf0b7 /src/runtime/tls_arm.s | |
parent | b456aac388f3d44b3fd936be00316caaff295c24 (diff) | |
download | go-b0344e9fd539256cffe630744311388aa94b0ecd.tar.gz go-b0344e9fd539256cffe630744311388aa94b0ecd.zip |
cmd/internal/obj, cmd/link, runtime: a saner model for TLS on arm
this leaves lots of cruft behind, will delete that soon
Change-Id: I12d6b6192f89bcdd89b2b0873774bd3458373b8a
Reviewed-on: https://go-review.googlesource.com/14196
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/tls_arm.s')
-rw-r--r-- | src/runtime/tls_arm.s | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/runtime/tls_arm.s b/src/runtime/tls_arm.s index d37970e1f8..4ff0ae4ccc 100644 --- a/src/runtime/tls_arm.s +++ b/src/runtime/tls_arm.s @@ -15,7 +15,7 @@ // Note: both functions will clobber R0 and R11 and // can be called from 5c ABI code. -// On android and darwin, runtime.tlsg is a normal variable. +// On android and darwin, runtime.tls_g is a normal variable. // TLS offset is computed in x_cgo_inittls. #ifdef GOOS_android #define TLSG_IS_VARIABLE @@ -41,14 +41,7 @@ TEXT runtime·save_g(SB),NOSPLIT,$-4 // The replacement function saves LR in R11 over the call to read_tls_fallback. 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. -#ifdef TLSG_IS_VARIABLE - MOVW runtime·tlsg(SB), R11 -#else - MOVW $runtime·tlsg(SB), R11 -#endif + MOVW runtime·tls_g(SB), R11 ADD R11, R0 MOVW g, 0(R0) MOVW g, R0 // preserve R0 across call to setg<> @@ -68,11 +61,7 @@ TEXT runtime·load_g(SB),NOSPLIT,$0 // $runtime.tlsg(SB) is a special linker symbol. // It is the offset from the TLS base pointer to our // thread-local storage for g. -#ifdef TLSG_IS_VARIABLE - MOVW runtime·tlsg(SB), R11 -#else - MOVW $runtime·tlsg(SB), R11 -#endif + MOVW runtime·tls_g(SB), R11 ADD R11, R0 MOVW 0(R0), g RET @@ -95,7 +84,11 @@ TEXT runtime·_initcgo(SB),NOSPLIT,$4 B.EQ nocgo MRC 15, 0, R0, C13, C0, 3 // load TLS base pointer MOVW R0, R3 // arg 3: TLS base pointer - MOVW $runtime·tlsg(SB), R2 // arg 2: tlsg +#ifdef TLSG_IS_VARIABLE + MOVW $runtime·tls_g(SB), R2 // arg 2: &tls_g +#else + MOVW $0, R2 // arg 2: not used when using platform tls +#endif MOVW $setg_gcc<>(SB), R1 // arg 1: setg MOVW g, R0 // arg 0: G BL (R4) // will clobber R0-R3 @@ -109,5 +102,7 @@ TEXT setg_gcc<>(SB),NOSPLIT,$0 B runtime·save_g(SB) #ifdef TLSG_IS_VARIABLE -GLOBL runtime·tlsg+0(SB), NOPTR, $4 +GLOBL runtime·tls_g+0(SB), NOPTR, $4 +#else +GLOBL runtime·tls_g+0(SB), TLSBSS, $4 #endif |