]> Cypherpunks repositories - gostls13.git/commit
cmd/link: do not add duplicate symbols to Allsym
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Wed, 16 Mar 2016 23:38:51 +0000 (12:38 +1300)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Thu, 17 Mar 2016 01:15:19 +0000 (01:15 +0000)
commit956e9e6c831e9018c2b82fedb9726c1299d421a9
tree69bbc863a57c192ea656e4554ca97dcc615bc75a
parentb2b5e779f51fa37cb241417887decf4be38240d6
cmd/link: do not add duplicate symbols to Allsym

When building shared libraries, all symbols on Allsym are marked reachable.
What I didn't realize was that this includes the ".dup" symbols created when
"dupok" symbols are read from multiple package files. This breaks now because
deadcode makes some assumptions that fail for these ".dup" symbols, but in any
case was a bad idea -- I suspect this change makes libstd.so a bunch smaller,
but creating it was broken before this CL so I can't be sure.

This change simply stops adding these symbols to Allsym, which might make some
of the many iterations over Allsym the linker does a touch quicker, although
that's not the motivation here.

Add a test that no symbols called ".dup" makes it into the runtime shared
library.

Fixes #14841

Change-Id: I65dd6e88d150a770db2d01b75cfe5db5fd4f8d25
Reviewed-on: https://go-review.googlesource.com/20780
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
misc/cgo/testshared/shared_test.go
src/cmd/link/internal/ld/decodesym.go
src/cmd/link/internal/ld/objfile.go
src/cmd/link/internal/ld/sym.go