ctxt.datap = append(ctxt.datap, data[symn]...)
}
- dwarfGenerateDebugSyms(ctxt)
-
var i int
for ; i < len(dwarfp); i++ {
s := dwarfp[i]
}
func (d *dwctxt2) dwarfGenerateDebugSyms() {
-
- // Hack: because the "wavefront" hasn't been pushed all the way
- // up to dodata(), there will have been changes made to the sym.Symbol's
- // that are not yet reflected in the loader. Call a temporary
- // loader routine that copies any changes back.
- // WARNING: changing a symbol's content will usually require
- // calling the loader cloneToExternal method, meaning that there
- // can be an increase in memory, so this is likely to mess up any
- // benchmarking runs.
- d.ldr.PropagateSymbolChangesBackToLoader()
-
abbrev := d.writeabbrev()
syms := []loader.Sym{abbrev}
}
}
dwarfp2 = syms
- anonVerReplacement := d.linkctxt.Syms.IncVersion()
- dwarfp = d.ldr.PropagateLoaderChangesToSymbols(dwarfp2, anonVerReplacement)
}
func (d *dwctxt2) collectlocs(syms []loader.Sym, units []*sym.CompilationUnit) []loader.Sym {
// Convert special symbols created by pcln.
pclntabFirstFunc = ctxt.loader.Syms[pclntabFirstFunc2]
pclntabLastFunc = ctxt.loader.Syms[pclntabLastFunc2]
+
+ // Populate dwarfp from dwarfp2. If we see a symbol index on dwarfp2
+ // whose loader.Syms entry is nil, something went wrong.
+ for _, symIdx := range dwarfp2 {
+ s := ctxt.loader.Syms[symIdx]
+ if s == nil {
+ panic(fmt.Sprintf("nil sym for dwarfp2 element %d", symIdx))
+ }
+ dwarfp = append(dwarfp, s)
+ }
}
func (ctxt *Link) dumpsyms() {
container := ctxt.pclntab()
bench.Start("findfunctab")
ctxt.findfunctab(container)
+ bench.Start("dwarfGenerateDebugSyms")
+ dwarfGenerateDebugSyms(ctxt)
bench.Start("loadlibfull")
ctxt.loadlibfull() // XXX do it here for now
bench.Start("symtab")
name := strings.Replace(osym.Name(r.Reader), "\"\".", r.pkgprefix, -1)
t := sym.AbiSymKindToSymKind[objabi.SymKind(osym.Type())]
// NB: for the test below, we can skip most anonymous symbols
- // since they will never be turned into sym.Symbols (ex:
- // funcdata), however DWARF subprogram DIE symbols (which are
- // nameless) will eventually need to be turned into
- // sym.Symbols (with relocations), so the simplest thing to do
- // is include them as part of this loop.
- if name == "" && t != sym.SDWARFINFO {
- continue
+ // since they will never be turned into sym.Symbols (eg:
+ // funcdata). DWARF symbols are an exception however -- we
+ // want to include all reachable but nameless DWARF symbols.
+ if name == "" {
+ switch t {
+ case sym.SDWARFINFO, sym.SDWARFRANGE, sym.SDWARFLOC, sym.SDWARFLINES:
+ default:
+ continue
+ }
}
ver := abiToVer(osym.ABI(), r.version)
if t == sym.SXREF {