cmd/link: don't assume all sections but __PKGDEF are object files #28429
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
I'm currently implementing support for modular static analysis in Google's build system. Unlike "go vet", which saves analysis facts in a .vetx file known to the build system, I'm taking the approach of storing the facts in an extra section in the .a files produced by cmd/pack, as this requires no changes to the build system. Analysis facts are thus, fittingly, treated much like type checker facts, which are recorded in the __PKGDEF section. Unfortunately, cmd/link blindly assumes that all sections not named __PKGDEF are object files, and tries to link them.
cmd/link should use a better heuristic for deciding what sections to link than
section.Name != "__PKGDEF"
; I proposestrings.HasSuffix(section.Name, ".o")
. Do we ever care about object files not called *.o?The text was updated successfully, but these errors were encountered: