fmt.Printf("%s -> %s\n", p, s.Name)
}
s.Attr |= sym.AttrReachable
- s.Reachparent = parent
+ if d.ctxt.Reachparent != nil {
+ d.ctxt.Reachparent[s] = parent
+ }
d.markQueue = append(d.markQueue, s)
}
s.Attr |= sym.AttrNotInSymbolTable
if s.Attr.Reachable() {
buf.WriteString(s.Name[9:])
- for p := s.Reachparent; p != nil; p = p.Reachparent {
+ for p := ctxt.Reachparent[s]; p != nil; p = ctxt.Reachparent[p] {
buf.WriteString("\t")
buf.WriteString(p.Name)
}
// unresolvedSymSet is a set of erroneous unresolved references.
// Used to avoid duplicated error messages.
unresolvedSymSet map[unresolvedSymKey]bool
+
+ // Used to implement field tracking.
+ Reachparent map[*sym.Symbol]*sym.Symbol
}
type unresolvedSymKey struct {
"bufio"
"cmd/internal/objabi"
"cmd/internal/sys"
+ "cmd/link/internal/sym"
"flag"
"log"
"os"
}
}
+ if objabi.Fieldtrack_enabled != 0 {
+ ctxt.Reachparent = make(map[*sym.Symbol]*sym.Symbol)
+ }
+
startProfile()
if ctxt.BuildMode == BuildModeUnset {
ctxt.BuildMode = BuildModeExe
// ElfType is set for symbols read from shared libraries by ldshlibsyms. It
// is not set for symbols defined by the packages being linked or by symbols
// read by ldelf (and so is left as elf.STT_NOTYPE).
- ElfType elf.SymType
- Sub *Symbol
- Outer *Symbol
- Gotype *Symbol
- Reachparent *Symbol
- File string
- Dynimplib string
- Dynimpvers string
- Sect *Section
- FuncInfo *FuncInfo
- Lib *Library // Package defining this symbol
+ ElfType elf.SymType
+ Sub *Symbol
+ Outer *Symbol
+ Gotype *Symbol
+ File string
+ Dynimplib string
+ Dynimpvers string
+ Sect *Section
+ FuncInfo *FuncInfo
+ Lib *Library // Package defining this symbol
// P contains the raw symbol data.
P []byte
R []Reloc