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.
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 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?