summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2014-10-27 17:19:41 -0400
committerAustin Clements <austin@google.com>2014-10-27 17:19:41 -0400
commit76b6806e2f08df32f2caa859d39cfc9ad812e22c (patch)
treeb1dafe3d41e17ddd709b09c612e16ac3a7171383
parent87729004ae12c22611b6bccf42211cb1f712ddb0 (diff)
downloadgo-76b6806e2f08df32f2caa859d39cfc9ad812e22c.tar.gz
[dev.power64] liblink: fix lost branch target
A recent commit lost the branch target in the really-big-stack case of splitstack, causing an infinite loop stack preempt case. Revive the branch target. LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/157790044
-rw-r--r--src/liblink/obj9.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/liblink/obj9.c b/src/liblink/obj9.c
index fa8af5f83..3db08c545 100644
--- a/src/liblink/obj9.c
+++ b/src/liblink/obj9.c
@@ -703,7 +703,7 @@ addstacksplit(Link *ctxt, LSym *cursym)
static Prog*
stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt)
{
- Prog *q1;
+ Prog *q, *q1;
// MOVD g_stackguard(g), R3
p = appendp(ctxt, p);
@@ -716,6 +716,7 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt)
p->to.type = D_REG;
p->to.reg = 3;
+ q = nil;
if(framesize <= StackSmall) {
// small stack: SP < stackguard
// CMP stackguard, SP
@@ -766,7 +767,7 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt)
p->to.type = D_CONST;
p->to.offset = StackPreempt;
- p = appendp(ctxt, p);
+ q = p = appendp(ctxt, p);
p->as = ABEQ;
p->to.type = D_BRANCH;
@@ -812,6 +813,8 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt)
p->from.offset = D_LR;
p->to.type = D_REG;
p->to.reg = 5;
+ if(q)
+ q->pcond = p;
// BL runtime.morestack(SB)
p = appendp(ctxt, p);