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/compile: method is inlined instead of loaded from shared library #19398

Closed
davidlazar opened this issue Mar 4, 2017 · 4 comments
Closed

Comments

@davidlazar
Copy link
Member

$ go version
go version devel +4a7cf960c3 Sat Mar 4 02:56:37 2017 +0000 linux/amd64

TestTwoGopathShlibs from misc/cgo/testshared fails when mid-stack inlining is enabled. To test with mid-stack inlining, we need to run the test by hand:

$ cd misc/cgo/testshared
$ export GOPATH=$PWD
$ go install -gcflags '-l=4' -installsuffix=6129484611666145821 -v -buildmode=shared runtime sync/atomic
$ go install -gcflags '-l=4' -installsuffix=6129484611666145821 -v -buildmode=shared -linkshared depBase
$ go install -gcflags '-l=4' -installsuffix=6129484611666145821 -v -buildmode=shared -linkshared dep2
$ go install -gcflags '-l=4' -installsuffix=6129484611666145821 -v -linkshared exe2

The last command fails with the output:

# exe2
main.main: relocation target os.Stdout not defined
main.main: relocation target type.*os.File not defined
go.itab.*reflect.rtype,reflect.Type: relocation target type.8b7X1see not defined
go.itab.*reflect.rtype,reflect.Type: relocation target type.H0+h5nWH not defined
main.main: undefined: "os.Stdout"
main.main: undefined: "type.*os.File"
go.itab.*reflect.rtype,reflect.Type: undefined: "type.8b7X1see"
go.itab.*reflect.rtype,reflect.Type: undefined: "type.H0+h5nWH"

The call to (*depBase.Dep).Method in exe2.go is inlined but this method should be dynamically loaded.

@davidlazar
Copy link
Member Author

cc @mwhudson @ianlancetaylor

@mwhudson
Copy link
Contributor

mwhudson commented Mar 5, 2017

Well it was a conscious decision at the time to allow inlining across module boundaries (partly because it was the easiest thing to do, perhaps). And those linker errors look like the compiler is violating some invariants that shouldn't really have anything to do with inlining. But I haven't looked at the details yet...

@aclements
Copy link
Member

@mwhudson, isn't one of the main points of shared objects to allow a shared object to be upgraded in an ABI-compatible way (security fixes, etc) without updating everything that depends on it?

@bradfitz bradfitz added this to the Go1.9Maybe milestone Mar 21, 2017
@bradfitz bradfitz modified the milestones: Go1.9Maybe, Go1.10 Jul 20, 2017
@mdempsky mdempsky modified the milestones: Go1.10, Go1.11 Nov 29, 2017
@gopherbot gopherbot modified the milestones: Go1.11, Unplanned May 23, 2018
@seankhliao
Copy link
Member

Obsoleted by #47788

@golang golang locked and limited conversation to collaborators Oct 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants