]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/link: remove implicit reachability setting from SymbolBuilder
authorThan McIntosh <thanm@google.com>
Fri, 12 Jun 2020 13:35:42 +0000 (09:35 -0400)
committerThan McIntosh <thanm@google.com>
Wed, 17 Jun 2020 12:04:40 +0000 (12:04 +0000)
commit0fb1517b3f0b643570d554ea66d5e6884fb0343e
tree93dfd5f31f8e1a58f41b8ff98d6f8c9bb9d37b52
parent27144d166b25de731bc26ee5bce861e4574b81bb
[dev.link] cmd/link: remove implicit reachability setting from SymbolBuilder

The loader's SymbolBuilder Add*/Set* methods include a call to mark
the underlying symbol as reachable (as a convenience, so that callers
would not have to set it explicitly). This code was carried over from
the corresponding sym.Symbol methods; back in the sym.Symbol world
unreachable symbols were never removed from the AllSyms slice, hence
setting and checking reachability was a good deal more important.

With the advent of the loader and the new deadcode implementation,
there is less of a need for this sort of fallback, and in addition the
implicit attr setting introduces data races in the the loader if there
are SymbolBuilder Add*/Set* method calls in parallel threads, as well
as adding overhead to the methods.

This patch gets rid of the implicit reachability setting, and instead
marks reachability in CreateSymForUpdate, as well as adding a few
explicit SetAttrReachable calls where needed.

Change-Id: I029a0c5a4a24237826a7831f9cbe5180d44cbc40
Reviewed-on: https://go-review.googlesource.com/c/go/+/237678
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
13 files changed:
src/cmd/link/internal/arm/asm.go
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/dwarf.go
src/cmd/link/internal/ld/elf.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/pcln.go
src/cmd/link/internal/ld/pe.go
src/cmd/link/internal/ld/symtab.go
src/cmd/link/internal/ld/typelink.go
src/cmd/link/internal/ld/xcoff.go
src/cmd/link/internal/loader/loader_test.go
src/cmd/link/internal/loader/symbolbuilder.go
src/cmd/link/internal/ppc64/asm.go