]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/link: make symbol attribute setting more reliable
authorCherry Zhang <cherryyz@google.com>
Wed, 29 Jul 2020 23:32:31 +0000 (19:32 -0400)
committerCherry Zhang <cherryyz@google.com>
Fri, 31 Jul 2020 21:02:26 +0000 (21:02 +0000)
commit847b9be3f62c7c93d3faf34577675e97176f6f7d
tree1876311ff7d2c1b86b0e062accce9b2c57f03382
parentc4ee16eda9734503a48d614e445b5d18ea94eb04
[dev.link] cmd/link: make symbol attribute setting more reliable

For dupOK symbols, their attributes should be OR'd. Most of the
attributes are expected to be set consistently across multiple
definitions, but UsedInIface must be OR'd, and for alignment we
need to pick the largest one. Currently the attributes are not
always OR'd, depending on addSym returning true or false. This
doesn't cause any real problem, but it would be a problem if we
make type descriptor symbols content-addressable.

This CL removes the second result of addSym, and lets preloadSyms
always set the attributes. Also removes the alignment handling on
addSym, handles it in preloadSyms only.

Change-Id: I06b3f0adb733f6681956ea9ef54736baa86ae7bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/245720
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/link/internal/loader/loader.go
src/cmd/link/internal/loader/loader_test.go