}
}
+ // Append the sym.Symbol's that correspond to the reachable
+ // loader.Sym's created by the new host object loader.
+ // FIXME: is this the right way to do this? Or should there be
+ // some way to associated a given host object symbol with the Go
+ // package that refers to it?
+ for _, s := range ctxt.Textp2 {
+ if !ctxt.loader.AttrReachable(s) {
+ continue
+ }
+ textp = append(textp, ctxt.loader.Syms[s])
+ }
+
// Put reachable text symbols into Textp.
// do it in postorder so that packages are laid down in dependency order
// internal first, then everything else
continue
}
libtextp := lib.Textp[:0]
- for _, s := range lib.Textp {
+ for idx, s := range lib.Textp {
if s.Attr.Reachable() {
textp = append(textp, s)
libtextp = append(libtextp, s)
if s.Unit != nil {
s.Unit.Textp = append(s.Unit.Textp, s)
+ s.Unit.Textp2 = append(s.Unit.Textp2, lib.Textp2[idx])
}
}
}
- for _, s := range lib.DupTextSyms {
+ for idx, s := range lib.DupTextSyms {
if s.Attr.Reachable() && !s.Attr.OnList() {
textp = append(textp, s)
libtextp = append(libtextp, s)
if s.Unit != nil {
s.Unit.Textp = append(s.Unit.Textp, s)
+ s.Unit.Textp2 = append(s.Unit.Textp2, lib.DupTextSyms2[idx])
}
s.Attr |= sym.AttrOnList
// dupok symbols may be defined in multiple packages. its
s := l.Syms[dupsym]
if s.Type == sym.STEXT {
lib.DupTextSyms = append(lib.DupTextSyms, s)
+ lib.DupTextSyms2 = append(lib.DupTextSyms2, sym.LoaderSym(dupsym))
}
}
continue
}
s.Attr.Set(sym.AttrOnList, true)
lib.Textp = append(lib.Textp, s)
+ lib.Textp2 = append(lib.Textp2, sym.LoaderSym(isym))
} else {
// there may be a dup in another package
// put into a temp list and add to text later
lib.DupTextSyms = append(lib.DupTextSyms, s)
+ lib.DupTextSyms2 = append(lib.DupTextSyms2, sym.LoaderSym(isym))
}
}
}
import "cmd/internal/dwarf"
+type LoaderSym int
+
// CompilationUnit is an abstraction used by DWARF to represent a chunk of
// debug-related data. We create a CompilationUnit per Object file in a
// library (so, one for all the Go code, one for each assembly file, etc.).
RangeSyms []*Symbol // Symbols for debug_range
Textp []*Symbol // Text symbols in this CU
DWARFFileTable []string // The file table used to generate the .debug_lines
+
+ Consts2 LoaderSym // Package constants DIEs (loader)
+ FuncDIEs2 []LoaderSym // Function DIE subtrees (loader)
+ AbsFnDIEs2 []LoaderSym // Abstract function DIE subtrees (loader)
+ RangeSyms2 []LoaderSym // Symbols for debug_range (loader)
+ Textp2 []LoaderSym // Text symbols in this CU (loader)
}