[dev.link] cmd/link: remove Sub field from sym.Symbol

Remove 'Sub' field from sym.Symbol, replacing uses (those downstream of
loadlibfull) with loader method calls.

NB: removing the Outer field will have to wait for now; it is accessed
in archreloc methods that don't have access to link ctxt or loader
currently.

Change-Id: I2abe5906fc169c64b2ab7d5ad213619bea5a17c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/230617
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Than McIntosh 2020-04-28 15:25:54 -04:00
parent 8493b64527
commit 9a3bf7d542
5 changed files with 11 additions and 8 deletions

View file

@ -2929,12 +2929,19 @@ func ElfSymForReloc(ctxt *Link, s *sym.Symbol) int32 {
}
}
func symSub(ctxt *Link, s *sym.Symbol) *sym.Symbol {
if lsub := ctxt.loader.SubSym(loader.Sym(s.SymIdx)); lsub != 0 {
return ctxt.loader.Syms[lsub]
}
return nil
}
func (ctxt *Link) dumpsyms() {
for _, s := range ctxt.loader.Syms {
if s == nil {
continue
}
fmt.Printf("%s %s reachable=%v onlist=%v outer=%v sub=%v\n", s, s.Type, s.Attr.Reachable(), s.Attr.OnList(), s.Outer, s.Sub)
fmt.Printf("%s %s reachable=%v onlist=%v outer=%v sub=%v\n", s, s.Type, s.Attr.Reachable(), s.Attr.OnList(), s.Outer, symSub(ctxt, s))
for i := range s.R {
fmt.Println("\t", s.R[i].Type, s.R[i].Sym)
}