cmd/link: replace SHIDDEN bit in SymKind with a bit of Attribute

This is https://go-review.googlesource.com/42025 but with some more fixes --
hidden symbols implicitly passed "Type == 0 || Type == SXREF" checks. (This
sort of thing is part of why I wanted to make this change)

Change-Id: I2273ee98570fd7f2dd8a799c692a2083c014235e
Reviewed-on: https://go-review.googlesource.com/42330
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Michael Hudson-Doyle 2017-04-28 12:43:06 +12:00
parent 7128ed0501
commit 1341104ae2
11 changed files with 36 additions and 17 deletions

View file

@ -2159,7 +2159,9 @@ func undefsym(ctxt *Link, s *sym.Symbol) {
if r.Sym == nil { // happens for some external ARM relocs
continue
}
if r.Sym.Type == sym.Sxxx || r.Sym.Type == sym.SXREF {
// TODO(mwhudson): the test of VisibilityHidden here probably doesn't make
// sense and should be removed when someone has thought about it properly.
if (r.Sym.Type == sym.Sxxx || r.Sym.Type == sym.SXREF) && !r.Sym.Attr.VisibilityHidden() {
Errorf(s, "undefined: %q", r.Sym.Name)
}
if !r.Sym.Attr.Reachable() && r.Type != objabi.R_WEAKADDROFF {