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

@ -399,6 +399,7 @@ type FuncInfo struct {
Locals int32
Text *Prog
Autom []*Auto
Autot map[*LSym]struct{}
Pcln Pcln
InlMarks []InlMark
@ -431,6 +432,15 @@ func (fi *FuncInfo) AddInlMark(p *Prog, id int32) {
fi.InlMarks = append(fi.InlMarks, InlMark{p: p, id: id})
}
// Record the type symbol for an auto variable so that the linker
// an emit DWARF type information for the type.
func (fi *FuncInfo) RecordAutoType(gotype *LSym) {
if fi.Autot == nil {
fi.Autot = make(map[*LSym]struct{})
}
fi.Autot[gotype] = struct{}{}
}
//go:generate stringer -type ABI
// ABI is the calling convention of a text symbol.
@ -644,7 +654,7 @@ type Link struct {
Imports []string
DiagFunc func(string, ...interface{})
DiagFlush func()
DebugInfo func(fn *LSym, curfn interface{}) ([]dwarf.Scope, dwarf.InlCalls) // if non-nil, curfn is a *gc.Node
DebugInfo func(fn *LSym, info *LSym, curfn interface{}) ([]dwarf.Scope, dwarf.InlCalls) // if non-nil, curfn is a *gc.Node
GenAbstractFunc func(fn *LSym)
Errors int