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/link: dies when using linkname on extern methods with -linkshared #22853
Comments
This is similar to #16632 and #22566, but I think a new issue with a test case might help. In this test case, I am trying to use type."".errorString SRODATA size=80 0x0000 10 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ................ 0x0010 25 34 58 05 07 08 08 18 00 00 00 00 00 00 00 00 %4X............. 0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0x0030 00 00 00 00 01 00 00 00 10 00 00 00 00 00 00 00 ................ 0x0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ rel 24+8 t=1 runtime.algarray+112 rel 32+8 t=1 runtime.gcbits.01+0 rel 40+4 t=5 type..namedata.*linkname1.errorString-+0 rel 44+4 t=5 type.*"".errorString+0 rel 48+4 t=5 type..importpath."".+0 rel 64+4 t=5 type..namedata.Error.+0 rel 68+4 t=24 type.func() string+0 rel 72+4 t=24 "".(*errorString).Error+0 rel 76+4 t=24 runtime.errorString.Error+0 Note that the I also tested with |
Change https://golang.org/cl/79635 mentions this issue: |
Change https://golang.org/cl/84496 mentions this issue: |
@ianlancetaylor Would you have time to comment on CL 79635? |
@ianlancetaylor Could this be considered for 1.11? Do you see some problem with the proposed fix? |
I have to admit that every time I look at this CL I bounce off it. If you wrote a feature request asking us to support using go:linkname to reference methods defined in a different shared library, I would probably vote to reject it. It locks us into a complexity that it's not clear that we need to support. Can you expand on the use case here? We do not intend go:linkname to be a general purpose facility, and using go:linkname for a method rather than a function seems especially fragile. |
Thanks Ian. I do understand your concern. Let me elaborate. The reason for using
Note that this CL allows the linker to fail more gracefully (instead of crashing) not only in the situation described in this issue, but also in the situation described in #16632. |
The risk of the CL is low, but I'm much less clear on the risk of permitting go:linkname on methods. That seems to lock us into a specific naming scheme for methods that as far as I know we are not locked into today. |
If your concern is that the compiler 's mangling scheme will be "locked in" by the On the other hand, the current mangling scheme is already exposed/exploited in tools like |
|
If we had to have a hack, it might as well be a robust hack. 😆 OK Ian, I guess I'll just have to think of something else for my use case. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.8, 1.9, tip
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?linux amd64
What did you do?
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: