aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-07-29 15:11:42 -0400
committerRuss Cox <rsc@golang.org>2015-07-29 21:34:50 +0000
commit3952057cf6597981efcc066349fcfae746333f83 (patch)
tree5c0d8ce67c1884189fa1e7363895b48abe82144b
parent23e4744c07f78151a4e9fa5187b84ed26fe3628b (diff)
downloadgo-3952057cf6597981efcc066349fcfae746333f83.tar.gz
go-3952057cf6597981efcc066349fcfae746333f83.zip
cmd/compile: align arm64 stack frames correctly
If the compiler doesn't do it, cmd/internal/obj/arm64 will, and that will break the zeroing of ambiguously live values done in zerorange, which in turn produces uninitialized pointer cells that the GC trips over. For #9880. Change-Id: Ice97c30bc8b36d06b7b88d778d87fab8e1827fdc Reviewed-on: https://go-review.googlesource.com/12847 Reviewed-by: Austin Clements <austin@google.com>
-rw-r--r--src/cmd/compile/internal/arm64/ggen.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/arm64/ggen.go b/src/cmd/compile/internal/arm64/ggen.go
index 851ca4e30f..6b0b40efbd 100644
--- a/src/cmd/compile/internal/arm64/ggen.go
+++ b/src/cmd/compile/internal/arm64/ggen.go
@@ -19,6 +19,13 @@ func defframe(ptxt *obj.Prog) {
ptxt.To.Val = int32(gc.Rnd(gc.Curfn.Type.Argwid, int64(gc.Widthptr)))
frame := uint32(gc.Rnd(gc.Stksize+gc.Maxarg, int64(gc.Widthreg)))
+
+ // arm64 requires that the frame size (not counting saved LR)
+ // be empty or be 8 mod 16. If not, pad it.
+ if frame != 0 && frame%16 != 8 {
+ frame += 8
+ }
+
ptxt.To.Offset = int64(frame)
// insert code to zero ambiguously live variables