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

plugin: noopt builder broken by plugin change #17937

Closed
bradfitz opened this issue Nov 16, 2016 · 4 comments
Closed

plugin: noopt builder broken by plugin change #17937

bradfitz opened this issue Nov 16, 2016 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bradfitz
Copy link
Contributor

The noopt builder is broken by the 03da269 (plugin versioning)

https://build.golang.org/log/857ba03fe3293b11a67a4391292aff2d3b29c28e

##### ../misc/cgo/testplugin
2016/11/15 16:27:25 plugin.Open failed: plugin.Open: plugin was built with a different version of package sync/atomic
2016/11/15 16:27:25 Failed: exit status 1
2016/11/15 16:27:25 FAILED
@bradfitz bradfitz added this to the Go1.8 milestone Nov 16, 2016
@ianlancetaylor ianlancetaylor changed the title misc/cgo: noopt builder broken by plugin change plugin: noopt builder broken by plugin change Nov 16, 2016
@wendigo
Copy link

wendigo commented Nov 16, 2016

Is it related to #17928 ?

@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Nov 16, 2016
gopherbot pushed a commit that referenced this issue Nov 22, 2016
Updates #17937

Change-Id: Ic822da1786a983b3b7bca21b68c3d5fc4bdfaee2
Reviewed-on: https://go-review.googlesource.com/33428
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
@bradfitz bradfitz modified the milestones: Go1.9, Go1.8 Nov 22, 2016
@bradfitz bradfitz modified the milestones: Go1.9, Go1.10 Jun 7, 2017
@crawshaw
Copy link
Member

crawshaw commented Sep 2, 2017

It looks like the noopt builder found a potentially interesting bug.

Code included in plugins is all compiled with the cmd/compile arg -shared. However binaries that load the plugin do not (by default on linux) build with -shared. As the dynamic linker will favor loaded code, that means plugins sometimes get different code when they are loaded. This trips over the package-hashing versioning check with noopt.

I can't think of any cases where this causes a program to fail. The -shared flag changes the way code references other symbols and restricts its register use. But the register use shouldn't matter across function calls, and as the binary is compiled as not-shared, the code it has loaded has to be able to reach other symbols already.

Unfortunately because of the way the go/build package works, fixing this in cmd/go is a bit of a kludge. It's hard to justify a kludge like this to get a builder working again and fix a potential bug. But I'll send the CL anyway.

@gopherbot
Copy link

Change https://golang.org/cl/61071 mentions this issue: cmd/go: build binaries that use plugins with -shared

@gopherbot
Copy link

Change https://golang.org/cl/62511 mentions this issue: misc: pass GO_GCFLAGS when building plugins

@golang golang locked and limited conversation to collaborators Sep 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants