Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/link: seg fault in shared buildmode from main package with exported variable #22566
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
Yes, I have run
Since you can't reproduce, I will try this again with a clean environment and post back.
referenced this issue
Nov 22, 2017
This only happens when the package name is "main", which seems to cause the toolchain to believe that it is building in plugin mode, and start to generate a lot more stuff than it would otherwise. The relocation that is missing a section is in
go.plugin.tabs SRODATA size=8 0x0000 00 00 00 00 00 00 00 00 ........ rel 0+4 t=5 type..namedata.Bar.+0 rel 4+4 t=5 type.*int+0
If the package was something other than "main", the compiler proceeds in shared mode, and there is no relocation:
I think both this and #16632 can be solved by moving basic types and import paths from the runtime package into the main package.
Edit: I realize that in general it's hard to tell whether a package will be the main package at compile time.