diff options
author | Shenghou Ma <minux@golang.org> | 2015-02-06 02:05:30 -0500 |
---|---|---|
committer | Minux Ma <minux@golang.org> | 2015-02-09 22:14:06 +0000 |
commit | 06611434479daf7d27bd2cd69d10be7d4cb5cd61 (patch) | |
tree | 90328b891100524a25de75cf446b734629f51c90 /src/runtime/tls_arm.s | |
parent | 04ce9dbf355a5d1b2e0b979d02f16ef2bf83833f (diff) | |
download | go-06611434479daf7d27bd2cd69d10be7d4cb5cd61.tar.gz go-06611434479daf7d27bd2cd69d10be7d4cb5cd61.zip |
liblink, runtime: move all references to runtime.tlsg to tls_arm.s
CL 2118 makes the assumption that all references to runtime.tlsg
should be accompanied by a declaration of runtime.tlsg if its type
should be a normal variable, instead of a placeholder for TLS
relocation.
Because if runtime.tlsg is not declared by the runtime package,
the type of runtime.tlsg will be zero, so fix the check in liblink
to look for 0 instead of STLSBSS (the type will be initialized by
cmd/ld, but cmd/ld doesn't run during assembly).
Change-Id: I691ac5c3faea902f8b9a0b963e781b22e7b269a7
Reviewed-on: https://go-review.googlesource.com/4030
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Diffstat (limited to 'src/runtime/tls_arm.s')
-rw-r--r-- | src/runtime/tls_arm.s | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/runtime/tls_arm.s b/src/runtime/tls_arm.s index 2dbab722b0..d130d42cf2 100644 --- a/src/runtime/tls_arm.s +++ b/src/runtime/tls_arm.s @@ -77,6 +77,27 @@ TEXT runtime·load_g(SB),NOSPLIT,$0 MOVW 0(R0), g RET +TEXT runtime·_initcgo(SB),NOSPLIT,$0 +#ifndef GOOS_nacl + // if there is an _cgo_init, call it. + MOVW _cgo_init(SB), R4 + CMP $0, R4 + 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 + MOVW $setg_gcc<>(SB), R1 // arg 1: setg + MOVW g, R0 // arg 0: G + BL (R4) // will clobber R0-R3 +#endif +nocgo: + RET + +// void setg_gcc(G*); set g called from gcc. +TEXT setg_gcc<>(SB),NOSPLIT,$0 + MOVW R0, g + B runtime·save_g(SB) + #ifdef TLSG_IS_VARIABLE GLOBL runtime·tlsg+0(SB), NOPTR, $4 #endif |