summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-29 21:23:52 -0400
committerRuss Cox <rsc@golang.org>2014-09-29 21:23:52 -0400
commit51c7c3269af143c16a8ad57f213044c31df9dd97 (patch)
tree8bc42fe6f0c9800e9dcb63a6653d846014b0b393
parentd6d0b5ad4a4354ef822ddced1fe79437dfcd1e94 (diff)
downloadgo-51c7c3269af143c16a8ad57f213044c31df9dd97.tar.gz
[release-branch.go1.3] runtime: hide cgocallback_gofunc calling cgocallbackg from linker
The linker error at http://build.golang.org/log/42c57ff6b57ab36f6622417108bb5697e4d36fa7 is a false positive: cgocallback_gofunc is invoked on the g0 stack, as explained in its comments, and then it switches to the m->curg stack to invoke cgocallbackg. Checking the stacksplit sequence on the g0 stack doesn't make sense, nor does carrying a check that starts on the g0 stack over to the curg stack. Change the code to use an indirect call so that the linker stacksplit check does not follow through it. LGTM=bradfitz, adg R=golang-codereviews, bradfitz, adg CC=golang-codereviews, iant, r https://codereview.appspot.com/146510043
-rw-r--r--src/pkg/runtime/asm_amd64.s3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pkg/runtime/asm_amd64.s b/src/pkg/runtime/asm_amd64.s
index 3c7eaf343..2e2886609 100644
--- a/src/pkg/runtime/asm_amd64.s
+++ b/src/pkg/runtime/asm_amd64.s
@@ -784,7 +784,8 @@ havem:
MOVQ BP, -8(DI)
LEAQ -(8+8)(DI), SP
MOVQ R8, 0(SP)
- CALL runtime·cgocallbackg(SB)
+ MOVQ $runtime·cgocallbackg(SB), AX // hide function call from linker
+ CALL AX
MOVQ 0(SP), R8
// Restore g->sched (== m->curg->sched) from saved values.