From 428062da4e5e35ce75178d993dd6d8ef5e3ecb5d Mon Sep 17 00:00:00 2001 From: Dmitriy Vyukov Date: Wed, 7 Dec 2011 16:53:17 +0300 Subject: ld: increase default stack size on Windows for cgo Fixes #2437. R=rsc, hectorchu, mattn.jp, alex.brainman, jdpoirier, snaury, n13m3y3r CC=golang-dev https://golang.org/cl/5371049 --- src/pkg/runtime/amd64/asm.s | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/pkg/runtime/amd64') diff --git a/src/pkg/runtime/amd64/asm.s b/src/pkg/runtime/amd64/asm.s index 109b95eba8..18cdefb83d 100644 --- a/src/pkg/runtime/amd64/asm.s +++ b/src/pkg/runtime/amd64/asm.s @@ -12,13 +12,19 @@ TEXT _rt0_amd64(SB),7,$-8 ANDQ $~15, SP MOVQ AX, 16(SP) MOVQ BX, 24(SP) + + // create istack out of the given (operating system) stack. + // initcgo may update stackguard. + MOVQ $runtime·g0(SB), DI + LEAQ (-8192+104)(SP), BX + MOVQ BX, g_stackguard(DI) + MOVQ SP, g_stackbase(DI) // if there is an initcgo, call it. MOVQ initcgo(SB), AX TESTQ AX, AX JZ needtls - LEAQ runtime·g0(SB), DI - CALL AX + CALL AX // g0 already in DI CMPL runtime·iswindows(SB), $0 JEQ ok @@ -44,16 +50,6 @@ ok: // save m->g0 = g0 MOVQ CX, m_g0(AX) - // create istack out of the given (operating system) stack - // if there is an initcgo, it had setup stackguard for us - MOVQ initcgo(SB), AX - TESTQ AX, AX - JNZ stackok - LEAQ (-8192+104)(SP), AX - MOVQ AX, g_stackguard(CX) -stackok: - MOVQ SP, g_stackbase(CX) - CLD // convention is D is always left cleared CALL runtime·check(SB) -- cgit v1.3-5-g9baa