1
0
mirror of https://github.com/golang/go synced 2024-11-23 16:40:03 -07:00

cmd/link: create DWARF types for autos based R_USETYPE relocs

Switch the linker over to use dummy R_USETYPE relocations on DWARF
subprogram DIEs as a means of insuring that DWARF types are created
for types of autotmp values used in live functions.

This change is part of a series intended to clean up handling of
autotmp types and remove use of autom's in the compiler and linker.

Updates #34554.

Change-Id: Ic74da6bd723ab7e4d8a16ad46e23228650d4b525
Reviewed-on: https://go-review.googlesource.com/c/go/+/197498
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:42:48 -04:00
parent 0b486d2a87
commit e72f002ed0
2 changed files with 22 additions and 0 deletions

View File

@ -1766,6 +1766,24 @@ func dwarfGenerateDebugInfo(ctxt *Link) {
// Create DIEs for global variables and the types they use.
genasmsym(ctxt, defdwsymb)
// Create DIEs for variable types indirectly referenced by function
// autos (which may not appear directly as param/var DIEs).
for _, lib := range ctxt.Library {
for _, unit := range lib.Units {
lists := [][]*sym.Symbol{unit.AbsFnDIEs, unit.FuncDIEs}
for _, list := range lists {
for _, s := range list {
for i := 0; i < len(s.R); i++ {
r := &s.R[i]
if r.Type == objabi.R_USETYPE {
defgotype(ctxt, r.Sym)
}
}
}
}
}
}
synthesizestringtypes(ctxt, dwtypes.Child)
synthesizeslicetypes(ctxt, dwtypes.Child)
synthesizemaptypes(ctxt, dwtypes.Child)

View File

@ -342,6 +342,10 @@ overwrite:
}
}
// Temporary: zero out the autom list after we've read it.
// In a subsequent patch we'll remove autom handling more completely.
pc.Autom = nil
pc.Pcsp.P = r.readData()
pc.Pcfile.P = r.readData()
pc.Pcline.P = r.readData()