-
Notifications
You must be signed in to change notification settings - Fork 18k
plugin: crash on darwin/amd64 #17828
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
Comments
And another:
crashes with:
Probably reason why first case (with import net/http.Header) crashes is exactly the same as 2nd case (I've copied net/http/header.go and distilled come with this case) |
Does |
I can reproduce this now on darwin/amd64. The plugin:
Will crash on
|
While off on other projects, it looks like I have forgotten a lot of how the darwin port works. Running
I don't have many spare moments to work on this over the next month, so we may have to pull plugin support on OS X from 1.8. |
OK, one more observation. While I cannot remember how that PC-relative MOVQ works, the same code works in -buildmode=c-shared on darwin, and generates:
So this problem could be more straightforward than some dynamic relocation mess. |
OK, not luck. This snippet is being mis-handled on darwin:
Unfortunately -dynlink on darwin is new for the plugin mode, so it could be anything. I'll try to find some more time for this next weekend. If I don't come up with anything, I'll pull plugin support on darwin. |
Sad to hear that @crawshaw |
The generated code looks fine, but definitely depends on the dynamic linker creating and filling out a GOT at 0x1cc24(%rip). IIRC, on ELF the external linker does that for you when it sees a R_X86_64_GOTPCREL relocation, maybe you need to do something else for macho? I don't know much of anything about how macho works though. |
@mwhudson thanks, for some reason I had just been assuming the GOT was fine. Looks like it wasn't, we were relocating to the outer "go.func.*" symbol in the GOT instead of the specific funcsym. CL 33211 fixes that problem, and might fix this entire issue. But I'll keep it open for now just in case. |
CL https://golang.org/cl/33211 mentions this issue. |
To generate the correct section offset the shared code path for R_CALL, R_PCREL, and R_GOTPCREL on darwin when externally linking walks up the symbol heirarchy adding the differences. This is fine, except in the case where we are generating a GOT lookup, because the topmost symbol is left in r.Xsym instead of the symbol we are looking up. So all funcsym GOT lookups were looking up the outer "go.func.*" symbol. Fix this by separating out the R_GOTPCREL code path. For #17828 (and may fix it). Change-Id: I2c9f4d135e77c17270aa064d8c876dc6d485d659 Reviewed-on: https://go-review.googlesource.com/33211 Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Closing with the hope that CL 33211 takes care of it. If it doesn't, please reopen this. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version devel +e017802 Sun Nov 6 20:11:48 2016 +0000 darwin/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
plugin.go:
host.go:
What did you expect to see?
plugin loaded without error
What did you see instead?
The text was updated successfully, but these errors were encountered: