Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: building plugin will fail with -gcflags="-N" #21197

Closed
st0012 opened this issue Jul 28, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@st0012
Copy link

commented Jul 28, 2017

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

go version go1.8.3 linux/amd64

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

Go env:

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build529090230=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

I build a plugin with -gcflags="-N":

go build -buildmode=plugin -gcflags="-N" -o ./main.so ./main.go

I have a repo that can reproduce the issue.
Just run docker build . and it should work.

Note

If I build it without setting gcflags and specifying build mode at the same time, it works. It fails only when both of them are set.

What did you expect to see?

It builds the plugin successfully.

What did you see instead?

Error messages, here's some of them:

runtime.rt_sigaction: nosplit stack overflow
        744     assumed on entry to runtime.sigfwdgo (nosplit)
        624     after runtime.sigfwdgo (nosplit) uses 120
        616     on entry to runtime.dieFromSignal (nosplit)
        592     after runtime.dieFromSignal (nosplit) uses 24
        584     on entry to runtime.setsig (nosplit)
        104     after runtime.setsig (nosplit) uses 480
        96      on entry to runtime.rt_sigaction (nosplit)
        -24     after runtime.rt_sigaction (nosplit) uses 120
runtime.bulkBarrierPreWrite: nosplit stack overflow
        744     assumed on entry to callRet (nosplit)
        704     after callRet (nosplit) uses 40
        696     on entry to runtime.reflectcallmove (nosplit)
        664     after runtime.reflectcallmove (nosplit) uses 32
        656     on entry to runtime.bulkBarrierPreWrite (nosplit)
        -48     after runtime.bulkBarrierPreWrite (nosplit) uses 704
runtime.systemstack: nosplit stack overflow
/usr/local/go/pkg/tool/linux_amd64/link: too many errors

@mvdan mvdan changed the title Building plugin will fail with -gcflags="-N" cmd/link: building plugin will fail with -gcflags="-N" Jul 28, 2017

@mvdan

This comment has been minimized.

Copy link
Member

commented Jul 28, 2017

@st0012 did you try on 1.9rc1?

CC @mdempsky @ianlancetaylor

@st0012

This comment has been minimized.

Copy link
Author

commented Jul 28, 2017

@mvdan It works on 1.9rc1, thanks!
BTW will you support compiling non-main package to plugin?
I'm trying to use non-main packages as plugin (let's why I wrap them into a main package and compile it), do you have any suggestion on this?

@mvdan

This comment has been minimized.

Copy link
Member

commented Jul 28, 2017

I have no idea - I'm not involved in the plugin work. Perhaps @crawshaw can answer.

In any case, use https://github.com/golang/go/wiki/Questions for questions.

Thanks!

@mvdan mvdan closed this Jul 28, 2017

@st0012

This comment has been minimized.

Copy link
Author

commented Jul 28, 2017

@mvdan Got it, thanks

@golang golang locked and limited conversation to collaborators Jul 28, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.