diff options
author | Russ Cox <rsc@golang.org> | 2014-04-16 22:08:00 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2014-04-16 22:08:00 -0400 |
commit | 70d330b5a3db8ce56983c1d36a0f43ce86857e8b (patch) | |
tree | 24ea8b9b79aa10066f27cbeb2bd35589f008289f /src/liblink/asm6.c | |
parent | 95c14bf6ef96625767e5625841207c8d2d6f6d8a (diff) | |
download | go-70d330b5a3db8ce56983c1d36a0f43ce86857e8b.tar.gz |
liblink, cmd/ld: reenable nosplit checking and test
The new code is adapted from the Go 1.2 nosplit code,
but it does not have the bug reported in issue 7623:
g% go run nosplit.go
g% go1.2 run nosplit.go
BUG
rejected incorrectly:
main 0 call f; f 120
linker output:
# _/tmp/go-test-nosplit021064539
main.main: nosplit stack overflow
120 guaranteed after split check in main.main
112 on entry to main.f
-8 after main.f uses 120
g%
Fixes issue 6931.
Fixes issue 7623.
LGTM=iant
R=golang-codereviews, iant, ality
CC=golang-codereviews, r
https://codereview.appspot.com/88190043
Diffstat (limited to 'src/liblink/asm6.c')
-rw-r--r-- | src/liblink/asm6.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/liblink/asm6.c b/src/liblink/asm6.c index b8029e10c..2c719a775 100644 --- a/src/liblink/asm6.c +++ b/src/liblink/asm6.c @@ -124,6 +124,7 @@ enum Z_rp, Zbr, Zcall, + Zcallindreg, Zib_, Zib_rp, Zibo_m, @@ -503,8 +504,8 @@ static uchar yloop[] = }; static uchar ycall[] = { - Ynone, Yml, Zo_m64, 0, - Yrx, Yrx, Zo_m64, 2, + Ynone, Yml, Zcallindreg, 0, + Yrx, Yrx, Zcallindreg, 2, Ynone, Ybr, Zcall, 1, 0 }; @@ -2903,6 +2904,7 @@ found: break; case Zo_m64: + case_Zo_m64: *ctxt->andptr++ = op; asmandsz(ctxt, &p->to, o->op[z+1], 0, 1); break; @@ -3074,11 +3076,18 @@ found: r->off = p->pc + ctxt->andptr - ctxt->and; r->sym = p->to.sym; r->add = p->to.offset; - r->type = R_PCREL; + r->type = R_CALL; r->siz = 4; put4(ctxt, 0); break; + case Zcallindreg: + r = addrel(ctxt->cursym); + r->off = p->pc; + r->type = R_CALLIND; + r->siz = 0; + goto case_Zo_m64; + case Zbr: case Zjmp: case Zloop: @@ -3548,7 +3557,7 @@ asmins(Link *ctxt, Prog *p) break; if(ctxt->rexflag) r->off++; - if(r->type == R_PCREL) + if(r->type == R_PCREL || r->type == R_CALL) r->add -= p->pc + n - (r->off + r->siz); } |