Skip to content

Commit 96eeaa1

Browse files
author
Elias Naur
committed
runtime: don't use thread local storage before it is set up on iOS
CL 138675 added a call to runtime.save_g which uses thread local storage to store g. On iOS however, that storage was not initialized yet. Move the call to below _cgo_init where it is set up. Change-Id: I14538d3e7d56ff35a6fa02c47bca306d24c38010 Reviewed-on: https://go-review.googlesource.com/c/150157 Run-TryBot: Elias Naur <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
1 parent b65f5c8 commit 96eeaa1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/asm_arm64.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ TEXT runtime·rt0_go(SB),NOSPLIT,$0
1818
// create istack out of the given (operating system) stack.
1919
// _cgo_init may update stackguard.
2020
MOVD $runtime·g0(SB), g
21-
BL runtime·save_g(SB)
2221
MOVD RSP, R7
2322
MOVD $(-64*1024)(R7), R0
2423
MOVD R0, g_stackguard0(g)
@@ -45,6 +44,7 @@ TEXT runtime·rt0_go(SB),NOSPLIT,$0
4544
ADD $16, RSP
4645

4746
nocgo:
47+
BL runtime·save_g(SB)
4848
// update stackguard after _cgo_init
4949
MOVD (g_stack+stack_lo)(g), R0
5050
ADD $const__StackGuard, R0

0 commit comments

Comments
 (0)