cmd/compile: add R_USETYPE relocs to func syms for autom types

During DWARF processing, keep track of the go type symbols for types
directly or indirectly referenced by auto variables in a function,
and add a set of dummy R_USETYPE relocations to the function's DWARF
subprogram DIE symbol.

This change is not useful on its own, but is part of a series of
changes intended to clean up handling of autom's in the compiler
and linker.

Updates #34554.

Change-Id: I974afa9b7092aa5dba808f74e00aa931249d6fe9
Reviewed-on: https://go-review.googlesource.com/c/go/+/197497
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
Than McIntosh 2019-09-26 08:38:33 -04:00
parent ac1d440ea6
commit 0b486d2a87
3 changed files with 36 additions and 10 deletions

View file

@ -597,7 +597,7 @@ func (ctxt *Link) populateDWARF(curfn interface{}, s *LSym, myimportpath string)
var scopes []dwarf.Scope
var inlcalls dwarf.InlCalls
if ctxt.DebugInfo != nil {
scopes, inlcalls = ctxt.DebugInfo(s, curfn)
scopes, inlcalls = ctxt.DebugInfo(s, info, curfn)
}
var err error
dwctxt := dwCtxt{ctxt}
@ -654,7 +654,7 @@ func (ctxt *Link) DwarfAbstractFunc(curfn interface{}, s *LSym, myimportpath str
if s.Func == nil {
s.Func = new(FuncInfo)
}
scopes, _ := ctxt.DebugInfo(s, curfn)
scopes, _ := ctxt.DebugInfo(s, absfn, curfn)
dwctxt := dwCtxt{ctxt}
filesym := ctxt.fileSymbol(s)
fnstate := dwarf.FnState{
@ -893,7 +893,7 @@ func (ft *DwarfFixupTable) Finalize(myimportpath string, trace bool) {
fns[idx] = fn
idx++
}
sort.Sort(bySymName(fns))
sort.Sort(BySymName(fns))
// Should not be called during parallel portion of compilation.
if ft.ctxt.InParallel {
@ -921,8 +921,8 @@ func (ft *DwarfFixupTable) Finalize(myimportpath string, trace bool) {
}
}
type bySymName []*LSym
type BySymName []*LSym
func (s bySymName) Len() int { return len(s) }
func (s bySymName) Less(i, j int) bool { return s[i].Name < s[j].Name }
func (s bySymName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s BySymName) Len() int { return len(s) }
func (s BySymName) Less(i, j int) bool { return s[i].Name < s[j].Name }
func (s BySymName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }