mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] cmd/link: demote dwarf {range,loc} sub-symbols to aux
When the compiler emits DWARF for a function F, in addition to the text symbol for F, it emits a set of sibling or child symbols that carry the various DWARF bits for F (for example, go.info.F, go.ranges.F, go.loc.F, and so on). Prior to the linker modernization work, name lookup was the way you made your way from a function symbol to one of its child DWARF symbols. We now have a new mechanism (aux symbols), so there is really no need for the DWARF sub-symbols to be named or to be dupok. This patch converts DWARF "range" and "loc" sub-symbols to be pure aux syms: unnamed, and connected to their parent text symbol only via aux data. This should presumably have performance benefits in that we add fewer symbols to the linker lookup tables. Other related DWARF sub-symbols (ex: go.line.*) will be handled in a subsequent patch. Change-Id: Iae3ec2d42452962d4afc1df4a1bd89ccdeadc6e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/222673 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
a6ae6d35e6
commit
8634642f9a
6 changed files with 44 additions and 27 deletions
|
|
@ -1856,6 +1856,7 @@ func (l *Loader) PropagateLoaderChangesToSymbols(toconvert []Sym, syms *sym.Symb
|
|||
|
||||
sn := l.SymName(cand)
|
||||
sv := l.SymVersion(cand)
|
||||
st := l.SymType(cand)
|
||||
if sv < 0 {
|
||||
sv = anonVerReplacement
|
||||
}
|
||||
|
|
@ -1866,7 +1867,7 @@ func (l *Loader) PropagateLoaderChangesToSymbols(toconvert []Sym, syms *sym.Symb
|
|||
if sn == "" {
|
||||
// Don't install anonymous symbols in the lookup tab.
|
||||
if s == nil {
|
||||
s := l.allocSym(sn, sv)
|
||||
s = l.allocSym(sn, sv)
|
||||
l.installSym(cand, s)
|
||||
}
|
||||
isnew = true
|
||||
|
|
@ -1885,7 +1886,7 @@ func (l *Loader) PropagateLoaderChangesToSymbols(toconvert []Sym, syms *sym.Symb
|
|||
|
||||
// Always copy these from new to old.
|
||||
s.Value = l.SymValue(cand)
|
||||
s.Type = l.SymType(cand)
|
||||
s.Type = st
|
||||
|
||||
// If the data for a symbol has increased in size, make sure
|
||||
// we bring the new content across.
|
||||
|
|
@ -1914,7 +1915,10 @@ func (l *Loader) PropagateLoaderChangesToSymbols(toconvert []Sym, syms *sym.Symb
|
|||
|
||||
// If this symbol has any DWARF file relocations, we need to
|
||||
// make sure that the relocations are copied back over, since
|
||||
// DWARF-gen alters the offset values for these relocs.
|
||||
// DWARF-gen alters the offset values for these relocs. Also:
|
||||
// if this is an info symbol and it refers to a previously
|
||||
// unseen range/loc symbol, we'll need to fix up relocations
|
||||
// for it as well.
|
||||
relocs := l.Relocs(cand)
|
||||
rslice = relocs.ReadSyms(rslice)
|
||||
for ri := range rslice {
|
||||
|
|
@ -1922,6 +1926,14 @@ func (l *Loader) PropagateLoaderChangesToSymbols(toconvert []Sym, syms *sym.Symb
|
|||
relfix = true
|
||||
break
|
||||
}
|
||||
if st != sym.SDWARFINFO {
|
||||
continue
|
||||
}
|
||||
rst := l.SymType(rslice[ri].Sym)
|
||||
if rst == sym.SDWARFRANGE || rst == sym.SDWARFLOC {
|
||||
relfix = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if relfix {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue