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/link: ABI hash for package in shared library should not include package's buildID #19920

Closed
mwhudson opened this issue Apr 11, 2017 · 1 comment

Comments

@mwhudson
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

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

1.7 (but nothing has changed here lately)

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

Linux.

What did you do?

Applied a distro patch that does not change the exported API of any package, but does add a new file (it adds a header file to runtime/cgo, to be precise)

What did you expect to see?

I expected the ABI hash of libstd.so to be the same.

What did you see instead?

It had changed.

This turns out to be because the linker computes the ABI hash for the shared library by hashing the __.PKGDEF file from each .a file going into the shared library. But that includes the build id that the go tool determines, which is irrelevant for this purpose. I think it would be better to just hash the first line of __.PKGDEF (which has the version of the compiler and GOEXPERIMENT markers) and then the export data, which after all is what the compiler looks at when compiling code that imports this package (which can be found by looking for $$ markers, I think).

Practice suggests that this might still be too fine -- I need to think about preventing inlining across module boundaries -- but that's mostly orthogonal, I think.

@gopherbot
Copy link

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

@golang golang locked and limited conversation to collaborators Apr 17, 2018
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

2 participants