diff options
author | Austin Clements <austin@google.com> | 2017-07-07 14:59:35 -0400 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2017-07-07 20:24:36 +0000 |
commit | 87a51a0787df797660b6462f2debb7188f50f249 (patch) | |
tree | fdb15a0ac04b1054b5d20a3c0907646684686be8 | |
parent | c027ecfdbaccc3baca8b7a2bf828ec8ba26f20fd (diff) | |
download | go-87a51a0787df797660b6462f2debb7188f50f249.tar.gz go-87a51a0787df797660b6462f2debb7188f50f249.zip |
runtime: save r11 in ARM addmoduledata
R11 is callee-save in the C ABI, but the temporary register in the Go
ABI. Currently it's being clobbered by runtime.addmoduledata, which
has to follow the C ABI. The observed effect of this was that
dl_open_worker was returning to a bad PC because after it failed to
restore its SP because it was using R11 as a frame pointer.
Fix this by saving R11 around addmoduledata.
Fixes #19674.
Change-Id: Iaacbcc76809a3aa536e9897770831dcbcb6c8245
Reviewed-on: https://go-review.googlesource.com/47831
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
-rw-r--r-- | src/runtime/asm_arm.s | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index 87f9378247..09b6759749 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -1011,11 +1011,13 @@ TEXT runtime·sigreturn(SB),NOSPLIT,$0-0 #ifndef GOOS_nacl // This is called from .init_array and follows the platform, not Go, ABI. -TEXT runtime·addmoduledata(SB),NOSPLIT,$0-4 +TEXT runtime·addmoduledata(SB),NOSPLIT,$0-8 MOVW R9, saver9-4(SP) // The access to global variables below implicitly uses R9, which is callee-save + MOVW R11, saver11-8(SP) // Likewise, R11 is the temp register, but callee-save in C ABI MOVW runtime·lastmoduledatap(SB), R1 MOVW R0, moduledata_next(R1) MOVW R0, runtime·lastmoduledatap(SB) + MOVW saver11-8(SP), R11 MOVW saver9-4(SP), R9 RET #endif |