mirror of
https://github.com/golang/go
synced 2024-11-18 06:54:49 -07:00
[dev.link] cmd/link: convert inltree syms to anonymous in pclntab
The pclntab phase generates a series of "inltree.*" symbols with inlining related pcdata; these symbols previously were given names and enterered into the symbol lookup table, but there is no real reason to do this, since they never need to be looked up when pcln generation is done. Switch them over to anonymous symbols. So as to insure that the later symtab phase picks them up correctly, assign them a type of SGOFUNC instead of SRODATA, and change symtab to look for this when assigning symbols to groups. Change-Id: I38225dbb130ad7aea5d16f79cef3d8d388c61c2b Reviewed-on: https://go-review.googlesource.com/c/go/+/227845 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
2f9decbe95
commit
ad6fcf6993
@ -192,17 +192,17 @@ func (state *pclnState) computeDeferReturn(target *Target, s loader.Sym) uint32
|
||||
return deferreturn
|
||||
}
|
||||
|
||||
// genInlTreeSym generates the InlTree sym for the a given function symbol
|
||||
// with name 'sn'.
|
||||
func (state *pclnState) genInlTreeSym(sn string, fi loader.FuncInfo, arch *sys.Arch) loader.Sym {
|
||||
itsName := "inltree." + sn
|
||||
// genInlTreeSym generates the InlTree sym for a function with the
|
||||
// specified FuncInfo.
|
||||
func (state *pclnState) genInlTreeSym(fi loader.FuncInfo, arch *sys.Arch) loader.Sym {
|
||||
ldr := state.ldr
|
||||
if ldr.Lookup(itsName, 0) != 0 {
|
||||
panic("should not exist yet")
|
||||
}
|
||||
its := ldr.LookupOrCreateSym(itsName, 0)
|
||||
its := ldr.CreateExtSym("", 0)
|
||||
inlTreeSym := ldr.MakeSymbolUpdater(its)
|
||||
inlTreeSym.SetType(sym.SRODATA)
|
||||
// Note: the generated symbol is given a type of sym.SGOFUNC, as a
|
||||
// signal to the symtab() phase that it needs to be grouped in with
|
||||
// other similar symbols (gcdata, etc); the dodata() phase will
|
||||
// eventually switch the type back to SRODATA.
|
||||
inlTreeSym.SetType(sym.SGOFUNC)
|
||||
ldr.SetAttrReachable(its, true)
|
||||
ninl := fi.NumInlTree()
|
||||
for i := 0; i < int(ninl); i++ {
|
||||
@ -453,7 +453,7 @@ func (ctxt *Link) pclntab() loader.Bitmap {
|
||||
}
|
||||
|
||||
if fi.Valid() && fi.NumInlTree() > 0 {
|
||||
its := state.genInlTreeSym(sn, fi, ctxt.Arch)
|
||||
its := state.genInlTreeSym(fi, ctxt.Arch)
|
||||
funcdata[objabi.FUNCDATA_InlTree] = its
|
||||
pcdata[objabi.PCDATA_InlTreeIndex] = sym.Pcdata{P: fi.Pcinline()}
|
||||
}
|
||||
|
@ -451,7 +451,8 @@ func (ctxt *Link) symtab() {
|
||||
s.Attr |= sym.AttrNotInSymbolTable
|
||||
}
|
||||
|
||||
if !s.Attr.Reachable() || s.Attr.Special() || s.Type != sym.SRODATA {
|
||||
if !s.Attr.Reachable() || s.Attr.Special() ||
|
||||
(s.Type != sym.SRODATA && s.Type != sym.SGOFUNC) {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -504,7 +505,7 @@ func (ctxt *Link) symtab() {
|
||||
case strings.HasPrefix(s.Name, "gcargs."),
|
||||
strings.HasPrefix(s.Name, "gclocals."),
|
||||
strings.HasPrefix(s.Name, "gclocals·"),
|
||||
strings.HasPrefix(s.Name, "inltree."),
|
||||
s.Type == sym.SGOFUNC && s != symgofunc,
|
||||
strings.HasSuffix(s.Name, ".opendefer"):
|
||||
s.Type = sym.SGOFUNC
|
||||
s.Attr |= sym.AttrNotInSymbolTable
|
||||
|
Loading…
Reference in New Issue
Block a user