diff options
| author | Cherry Zhang <cherryyz@google.com> | 2020-07-27 11:36:41 -0400 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2020-07-27 16:04:55 +0000 |
| commit | 19a932ceb8dc0059754e1f986c86daba3a4fb14e (patch) | |
| tree | 843cb75b26223ddd5283dabdadee97b1e6a26757 /src | |
| parent | 8696ae82c94f0a7707cbbbdf2cec44e93edf5b23 (diff) | |
| download | go-19a932ceb8dc0059754e1f986c86daba3a4fb14e.tar.xz | |
cmd/link: don't mark shared library symbols reachable unconditionally
During the transitioning period, we mark symbols from Go shared
libraries reachable unconditionally. That might be useful when
there was still a large portion of the linker using sym.Symbols,
and only reachable symbols were converted to sym.Symbols. Marking
them reachable brings them to the dynamic symbol table, even if
they are not needed, increased the binary size unexpectedly.
That time has passed. Now we largely operate on loader symbols,
and it is not needed to mark them reachable anymore.
Fixes #40416.
Change-Id: I1e2bdb93a960ba7dc96575fabe15af93d8e95329
Reviewed-on: https://go-review.googlesource.com/c/go/+/244839
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/link/internal/ld/lib.go | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index b0a9613e4f..0366bc7a6f 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -2191,17 +2191,6 @@ func ldshlibsyms(ctxt *Link, shlib string) { l.SetSymElfType(s, elf.ST_TYPE(elfsym.Info)) su.SetSize(int64(elfsym.Size)) if elfsym.Section != elf.SHN_UNDEF { - // If it's not undefined, mark the symbol as reachable - // so as to protect it from dead code elimination, - // even if there aren't any explicit references to it. - // Under the previous sym.Symbol based regime this - // wasn't necessary, but for the loader-based deadcode - // it is definitely needed. - // - // FIXME: have a more general/flexible mechanism for this? - // - l.SetAttrReachable(s, true) - // Set .File for the library that actually defines the symbol. l.SetSymPkg(s, libpath) |
