]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj, cmd/link, runtime: use a larger stack frame on ppc64
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Thu, 29 Oct 2015 23:36:08 +0000 (12:36 +1300)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Thu, 12 Nov 2015 22:32:37 +0000 (22:32 +0000)
The larger stack frames causes the nosplit stack to overflow so the next change
increases the stackguard.

Change-Id: Ib2b4f24f0649eb1d13e3a58d265f13d1b6cc9bf9
Reviewed-on: https://go-review.googlesource.com/15964
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/internal/obj/link.go
src/cmd/link/internal/ld/link.go
src/runtime/asm_ppc64x.h
src/runtime/asm_ppc64x.s
src/runtime/internal/sys/arch_ppc64.go
src/runtime/internal/sys/arch_ppc64le.go

index 8ebb2f4c628391ed47ab80f68a5936cfd511693a..c1f2260e76210ebe3d5879ec59edbb6e253bef7e 100644 (file)
@@ -585,6 +585,10 @@ func (ctxt *Link) FixedFrameSize() int64 {
        switch ctxt.Arch.Thechar {
        case '6', '8':
                return 0
+       case '9':
+               // PIC code on ppc64le requires 32 bytes of stack, and it's easier to
+               // just use that much stack always on ppc64x.
+               return int64(4 * ctxt.Arch.Ptrsize)
        default:
                return int64(ctxt.Arch.Ptrsize)
        }
index a9ea2d958993eff76edd38d60dbe717b4135d9d8..73d23c6cf0a659e50648f579f845f4889a6bb6f0 100644 (file)
@@ -168,6 +168,10 @@ func (ctxt *Link) FixedFrameSize() int64 {
        switch ctxt.Arch.Thechar {
        case '6', '8':
                return 0
+       case '9':
+               // PIC code on ppc64le requires 32 bytes of stack, and it's easier to
+               // just use that much stack always on ppc64x.
+               return int64(4 * ctxt.Arch.Ptrsize)
        default:
                return int64(ctxt.Arch.Ptrsize)
        }
index a2d2e5beafb00793395f636b03b60b5afc8b5a35..a413df648846f3935f07a0aa2a389cce49dbeedb 100644 (file)
 // with arguments (the arguments should be stored at FIXED_FRAME+0(R1),
 // FIXED_FRAME+8(R1) etc) and some other low-level places.
 //
-// The reason for using a constant is when code is compiled as PIC on ppc64le
-// the fixed part of the stack is 32 bytes large (although PIC is not actually
-// supported yet).
+// The reason for using a constant is to make supporting PIC easier (although
+// we only support PIC on ppc64le which has a minimum 32 bytes of stack frame,
+// and currently always use that much, PIC on ppc64 would need to use 48).
 
-#ifdef GOARCH_ppc64
-#define FIXED_FRAME 8
-#endif
-
-#ifdef GOARCH_ppc64le
-#define FIXED_FRAME 8
-#endif
+#define FIXED_FRAME 32
index 6f1191be0295a7cc0b34b1bcce9142665f4ee742..5f5a658562e1354904846d6b1bd67b8a1a2122b3 100644 (file)
@@ -74,8 +74,11 @@ nocgo:
        MOVDU   R3, -8(R1)
        MOVDU   R0, -8(R1)
        MOVDU   R0, -8(R1)
+       MOVDU   R0, -8(R1)
+       MOVDU   R0, -8(R1)
+       MOVDU   R0, -8(R1)
        BL      runtime·newproc(SB)
-       ADD     $24, R1
+       ADD     $(16+FIXED_FRAME), R1
 
        // start this M
        BL      runtime·mstart(SB)
@@ -174,6 +177,9 @@ TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8
        MOVD    (g_sched+gobuf_sp)(g), R1       // sp = m->g0->sched.sp
        MOVDU   R3, -8(R1)
        MOVDU   R0, -8(R1)
+       MOVDU   R0, -8(R1)
+       MOVDU   R0, -8(R1)
+       MOVDU   R0, -8(R1)
        BL      (CTR)
        BR      runtime·badmcall2(SB)
 
index fca31c28d0fceb320c8c2c410b6bee448e88760c..3aa07e1f5648ab3af0f0f617a9106dd7dfd697ef 100644 (file)
@@ -12,7 +12,7 @@ const (
        PCQuantum     = 4
        Int64Align    = 8
        HugePageSize  = 0
-       MinFrameSize  = 8
+       MinFrameSize  = 32
 )
 
 type Uintreg uint64
index 586a954a0c2f0830d3a5d895f8e23128b1d02cad..0f02f0bf3c4a3d80f82a636a79999edb955790b4 100644 (file)
@@ -12,7 +12,7 @@ const (
        PCQuantum     = 4
        Int64Align    = 8
        HugePageSize  = 0
-       MinFrameSize  = 8
+       MinFrameSize  = 32
 )
 
 type Uintreg uint64