Skip to content

runtime: building with -gcflags="-N -l" fails #18774

Closed
@artiomn

Description

@artiomn

What version of Go are you using (go version)?

1.6.2 on Linux, 1.7 windows/amd64 on windows.

What operating system and processor architecture are you using (go env)?

Windows x86_64, Linux x86_64, MacOS x86_64.

What did you do?

I had built go package and have got stack overflow in the go compiler (with a specific parameters combination). Problem is reproduced on all operating systems, described above.

user@dev-debian ~/Desktop/repos/go_packages/src/test $ uname -a                     
Linux dev-debian 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux
user@dev-debian ~/Desktop/repos/go_packages/src/test $ cat main.go
go
package main

import "fmt"


func main() {
    fmt.Println("hello world")
}
user@dev-debian ~/Desktop/repos/go_packages/src/test $ echo "$GOOS, $GOARCH"                      
linux, amd64
user@dev-debian ~/Desktop/repos/go_packages/src/test $ ls
main.go
user@dev-debian ~/Desktop/repos/go_packages/src/test $ go build -gcflags="-N -l" -pkgdir pkg -o test .
# test
runtime.typedslicecopy: nosplit stack overflow
        584     assumed on entry to runtime.typedslicecopy (nosplit)
        448     after runtime.typedslicecopy (nosplit) uses 136
        440     on entry to runtime.cgoCheckSliceCopy (nosplit)
        376     after runtime.cgoCheckSliceCopy (nosplit) uses 64
        368     on entry to runtime.cgoCheckTypedBlock (nosplit)
        168     after runtime.cgoCheckTypedBlock (nosplit) uses 200
        160     on entry to runtime.cgoCheckBits (nosplit)
        24      after runtime.cgoCheckBits (nosplit) uses 136
        16      on entry to runtime.cgoIsGoPointer (nosplit)
        -32     after runtime.cgoIsGoPointer (nosplit) uses 48
runtime.sigtrampgo: nosplit stack overflow
        584     assumed on entry to runtime.sigtrampgo (nosplit)
        392     after runtime.sigtrampgo (nosplit) uses 192
        384     on entry to runtime.sigfwdgo (nosplit)
        288     after runtime.sigfwdgo (nosplit) uses 96
        280     on entry to runtime.dieFromSignal (nosplit)
        240     after runtime.dieFromSignal (nosplit) uses 40
        232     on entry to runtime.setsig (nosplit)
        40      after runtime.setsig (nosplit) uses 192
        32      on entry to runtime.funcPC (nosplit)
        0       after runtime.funcPC (nosplit) uses 32
        -8      on entry to runtime.add (nosplit)
runtime.cgocallback_gofunc: nosplit stack overflow
        584     assumed on entry to runtime.cgocallback_gofunc (nosplit)
        576     after runtime.cgocallback_gofunc (nosplit) uses 8
        568     on entry to runtime.cgocallbackg (nosplit)
        480     after runtime.cgocallbackg (nosplit) uses 88
        472     on entry to runtime.exitsyscall (nosplit)
        352     after runtime.exitsyscall (nosplit) uses 120
        344     on entry to runtime.exitsyscallfast (nosplit)
        184     after runtime.exitsyscallfast (nosplit) uses 160
        176     on entry to runtime.writebarrierptr (nosplit)
        128     after runtime.writebarrierptr (nosplit) uses 48
        120     on entry to runtime.cgoCheckWriteBarrier (nosplit)
        56      after runtime.cgoCheckWriteBarrier (nosplit) uses 64
        48      on entry to runtime.cgoIsGoPointer (nosplit)
        0       after runtime.cgoIsGoPointer (nosplit) uses 48
        -8      on entry to runtime.cgoInRange (nosplit)

What did you expect to see?

Compiled binary.

Remarks

Look at the pkgdir parameter, gcflags -N option and GOOS/GOARCH environment variables.
Under Windows it was reproduced even without -pkgdir.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions