aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/tls_arm.s
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2017-04-08 14:27:33 -0400
committerDave Cheney <dave@cheney.net>2017-04-08 22:51:18 +0000
commit0020b8a2572a953b8521ce75367779255c5a1436 (patch)
tree36bfacc3ccedd0a5c7c7f09768de917bbb6779a0 /src/runtime/tls_arm.s
parente0efdac65a9c06f87c49ef0818bd883c1fb6f35e (diff)
downloadgo-0020b8a2572a953b8521ce75367779255c5a1436.tar.gz
go-0020b8a2572a953b8521ce75367779255c5a1436.zip
runtime: prevent TLS fetching instructions from being assembled on NaCl/ARM
They are dead code already, but the verifier is still not happy. Don't assemble them at all. Looks like it has been like that for long. I don't know why it was ok. Maybe the verifier is now more picky? Fixes #19884. Change-Id: Ib806fb73ca469789dec56f52d484cf8baf7a245c Reviewed-on: https://go-review.googlesource.com/40111 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Dave Cheney <dave@cheney.net>
Diffstat (limited to 'src/runtime/tls_arm.s')
-rw-r--r--src/runtime/tls_arm.s6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/runtime/tls_arm.s b/src/runtime/tls_arm.s
index 32bfcf88f0..a5f5003ea8 100644
--- a/src/runtime/tls_arm.s
+++ b/src/runtime/tls_arm.s
@@ -35,7 +35,7 @@ TEXT runtime·save_g(SB),NOSPLIT,$-4
// nothing to do as nacl/arm does not use TLS at all.
MOVW g, R0 // preserve R0 across call to setg<>
RET
-#endif
+#else
// If the host does not support MRC the linker will replace it with
// a call to runtime.read_tls_fallback which jumps to __kuser_get_tls.
// The replacement function saves LR in R11 over the call to read_tls_fallback.
@@ -46,6 +46,7 @@ TEXT runtime·save_g(SB),NOSPLIT,$-4
MOVW g, 0(R0)
MOVW g, R0 // preserve R0 across call to setg<>
RET
+#endif
// load_g loads the g register from pthread-provided
// thread-local memory, for use after calling externally compiled
@@ -54,7 +55,7 @@ TEXT runtime·load_g(SB),NOSPLIT,$0
#ifdef GOOS_nacl
// nothing to do as nacl/arm does not use TLS at all.
RET
-#endif
+#else
// See save_g
MRC 15, 0, R0, C13, C0, 3 // fetch TLS base pointer
BIC $3, R0 // Darwin/ARM might return unaligned pointer
@@ -62,6 +63,7 @@ TEXT runtime·load_g(SB),NOSPLIT,$0
ADD R11, R0
MOVW 0(R0), g
RET
+#endif
// This is called from rt0_go, which runs on the system stack
// using the initial stack allocated by the OS.