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/go: --buildmode plugin fails: cannot handle R_TLS_IE #17415

Closed
rogpeppe opened this issue Oct 12, 2016 · 5 comments
Closed

cmd/go: --buildmode plugin fails: cannot handle R_TLS_IE #17415

rogpeppe opened this issue Oct 12, 2016 · 5 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rogpeppe
Copy link
Contributor

What version of Go are you using (go version)?

go version devel +2287296 Wed Oct 12 08:03:00 2016 +0000 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOOS="linux"
GOPATH="/home/rog/src/go"
GOTOOLDIR="/home/rog/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build045198637=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

go build -buildmode plugin tst.go

where tst.go was:

package main
func main() {}
var Foo = 99

What did you expect to see?

A built plugin binary.

What did you see instead?

# command-line-arguments
2016/10/12 10:58:11 cannot handle R_TLS_IE (sym runtime.memhash8) when linking internally
@ianlancetaylor
Copy link
Contributor

I think the bug here is that the error message is not very good.

A plugin that does not export any symbols, which requires using import "C", is not very useful.

@quentinmit
Copy link
Contributor

@ianlancetaylor Where does this use import "C"? I see an exported symbol, "Foo".

@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 12, 2016
@ianlancetaylor
Copy link
Contributor

I'm sorry, you're right, I got confused between this and -buildmode=c-shared.

Seems like -buildmode=plugin needs to force an external link, probably by changing mustLinkExternal in cmd/link/internal/ld/config.go.

@crawshaw
Copy link
Member

Agreed. Sending a CL.

@gopherbot
Copy link

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

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

5 participants