Commit e72f002e authored by Than McIntosh's avatar Than McIntosh

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: default avatarJeremy Faller <jeremy@golang.org>
parent 0b486d2a
......@@ -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)
......
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment