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: symbol lookup fails if plugin not in current directory #17155

Closed
paulsmith opened this issue Sep 19, 2016 · 4 comments
Closed

plugin: symbol lookup fails if plugin not in current directory #17155

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

Comments

@paulsmith
Copy link

paulsmith commented Sep 19, 2016

go version devel +964639c Sat Sep 17 14:21:32 2016 +0000 darwin/amd64

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/paul"
GORACE=""
GOROOT="/go"
GOTOOLDIR="/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build779914587=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

If the name of the plugin given to plugin.Open is a path to a file not in the current directory, like "plugins/foo.so", symbol name lookup will fail with an error like:

plugin.Open: could not find symbol MyFunc: /home/paul/src/example/plugins/foo.so: undefined symbol: plugins/foo.MyFunc

The symbol to be looked up in the example should be foo.MyFunc, not plugins/foo.MyFunc.

@gopherbot
Copy link

CL https://golang.org/cl/29377 mentions this issue.

@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 4, 2016
@quentinmit quentinmit added this to the Go1.8 milestone Oct 4, 2016
@quentinmit
Copy link
Contributor

Why is it looking at plugins/foo.MyFunc to begin with? The docs say that the package should be called "main"; is there something internal to plugin .so files where the "main" package is renamed to the filename instead?

@crawshaw
Copy link
Member

crawshaw commented Oct 5, 2016

Yes. Otherwise symbols would conflict between plugins and the host binary.

Unfortunately it's not complete. It needs to use the entire path to the package to avoid conflicts between plugins.

@gopherbot
Copy link

CL https://golang.org/cl/32355 mentions this issue.

@golang golang locked and limited conversation to collaborators Oct 31, 2017
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

4 participants