The code.google.com/p/go.text/encoding/charmap package contains variable pairs like:
var CodePage437 encoding.Encoding = &codePage437
var codePage437 = charmap{ /* a data table */ }
encoding.Encoding is an interface, so that the CodePage437 variable currently requires a
convT2I call, in a package init function. (issue #6289 is possibly related, but even if
that was fixed, suppose for argument's sake that CodePage437 was initialized by a
constructed-at-runtime composite literal.)
Because CodePage437 is implicitly referenced by a package init function, the linker
considers it used by any program that imports that package, even if it otherwise doesn't
refer to CodePage437. The linker thus can't drop the unused data table (and maybe other
related metadata like pclntab??), and likewise for the N other encoding.Encoding
implementations in that package.
The text was updated successfully, but these errors were encountered:
rsc
changed the title
cmd/ld: linker cannot discard unused but runtime-initialized global variables
cmd/link: linker cannot discard unused but runtime-initialized global variables
Jun 8, 2015
The text was updated successfully, but these errors were encountered: