/ go Public
cmd/link: package versioning for shared libraries is incompatible with linkobj builds #24512
Issues related to the Go compiler and/or runtime.
The path to resolution is known, but the work has not been done.
During linkobj builds, __.PKGDEF files are still included in the linker object files, but they're empty stub files that only contain information already present in the .o file, so I'm looking at getting rid of them in that case.
Working on cmd/link, I notice that genhash (used for generating package versions from the __.PKGDEF files for shared library builds) makes two assumptions that are incompatible with this:
They assume __.PKGDEF files are the first file in the .a. This is currently true because loadobjfile requires it to be the case, but won't be if we get rid of the __.PKGDEF files from linkobj files (as I intend to do).
In linkobj builds, the __.PKGDEF file is largely useless for versioning because it doesn't actually record anything about the package. So the versioning is broken.
My plan here is:
Near-term: change cmd/link to not require __.PKGDEF files for non-shared builds, change genhash to error if the archive is missing a __.PKGDEF file, and change cmd/compile to stop producing useless __.PKGDEF files in linkobj files.
This means shared library, linkobj builds will now explicitly fail, whereas before they would work but be subtly incorrect due to useless package version files.
Intermediate-term: have cmd/compile compute the package version hash and include it directly in the link object, so that cmd/link doesn't need the __.PKGDEF at all.
/cc @ianlancetaylor @mwhudson
The text was updated successfully, but these errors were encountered: