cmd/link: support symbol indexing for DUPOK symbols #47448
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
FeatureRequest
Issues asking for a new feature that does not need a proposal.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
A common situation within the compiler is package A defines a DUPOK symbol X, package B imports package A, and then package B needs to refer to that same DUPOK symbol X.
Today, we handle this by having package B re-defined symbol X, and the linker discards the duplicates. This works fine (and in general, we do need the linker to support DUPOK symbols), but it means the compiler spends unnecessary time re-defining the symbol, and it means the object files are unnecessarily large with redundant definitions.
It would be nice if we could still use symbol indexing to refer to DUPOK symbols defined in another object file. Today, this would already be useful for cutting down redundant type descriptors for anonymous types and method wrappers; but it's likely to be useful for avoiding time spent compiling redundant instantiations of generic functions/types too.
/cc @cherrymui
The text was updated successfully, but these errors were encountered: