aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2020-05-20 13:51:59 -0400
committerThan McIntosh <thanm@google.com>2020-05-26 17:31:19 +0000
commit96ec09da4885f0c09f0b1bb94d0a1e2b483495ca (patch)
treea092d99a91c755ea0c22b440b035d4bbfe3d1c49 /src/cmd/internal/obj
parentde1f07d56d3a0c8a6ca5cf2553abcf536785e1eb (diff)
downloadgo-96ec09da4885f0c09f0b1bb94d0a1e2b483495ca.tar.xz
[dev.link] cmd/{compile,link}: split SDWARFINFO symtype into sub-types
This change splits the SDWARFINFO symbol type (a generic container of DWARF content) into separate sub-classes. The new symbol types are SDWARFCUINFO comp unit DIE, also CU info and CU packagename syms SDWARFCONST constant DIE SDWARFFCN subprogram DIE (default and concrete) SDWARFABSFCN abstract function DIE SDWARFTYPE type DIE SDWARFVAR global variable DIE Advantage of doing this: in the linker there are several places where we have to iterate over a symbol's relocations to pick out references to specific classes of DWARF sub-symbols (for example, looking for all abstract function DIEs referenced by a subprogram DIE, or looking at all the type DIEs used in a subprogram DIE). By splitting SDWARFINFO into parts clients can now look only at the relocation target's sym type as opposed to having to materialize the target sym name, or do a lookup. Change-Id: I4e0ee3216d3c8f1a78bec3d296c01e95b3d025b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/234684 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
Diffstat (limited to 'src/cmd/internal/obj')
-rw-r--r--src/cmd/internal/obj/objfile.go6
-rw-r--r--src/cmd/internal/obj/objfile2.go3
2 files changed, 5 insertions, 4 deletions
diff --git a/src/cmd/internal/obj/objfile.go b/src/cmd/internal/obj/objfile.go
index 5e7018eb6e..c0194c5a6d 100644
--- a/src/cmd/internal/obj/objfile.go
+++ b/src/cmd/internal/obj/objfile.go
@@ -205,7 +205,7 @@ func (ctxt *Link) dwarfSym(s *LSym) (dwarfInfoSym, dwarfLocSym, dwarfRangesSym,
}
if s.Func.dwarfInfoSym == nil {
s.Func.dwarfInfoSym = &LSym{
- Type: objabi.SDWARFINFO,
+ Type: objabi.SDWARFFCN,
}
if ctxt.Flag_locationlists {
s.Func.dwarfLocSym = &LSym{
@@ -296,7 +296,7 @@ func (ctxt *Link) DwarfIntConst(myimportpath, name, typename string, val int64)
return
}
s := ctxt.LookupInit(dwarf.ConstInfoPrefix+myimportpath, func(s *LSym) {
- s.Type = objabi.SDWARFINFO
+ s.Type = objabi.SDWARFCONST
ctxt.Data = append(ctxt.Data, s)
})
dwarf.PutIntConst(dwCtxt{ctxt}, s, ctxt.Lookup(dwarf.InfoPrefix+typename), myimportpath+"."+name, val)
@@ -422,7 +422,7 @@ func (ft *DwarfFixupTable) SetPrecursorFunc(s *LSym, fn interface{}) {
// the back end.
absfn := ft.ctxt.LookupDerived(s, dwarf.InfoPrefix+s.Name+dwarf.AbstractFuncSuffix)
absfn.Set(AttrDuplicateOK, true)
- absfn.Type = objabi.SDWARFINFO
+ absfn.Type = objabi.SDWARFABSFCN
ft.ctxt.Data = append(ft.ctxt.Data, absfn)
// In the case of "late" inlining (inlines that happen during
diff --git a/src/cmd/internal/obj/objfile2.go b/src/cmd/internal/obj/objfile2.go
index c28ae569d3..4679bbb445 100644
--- a/src/cmd/internal/obj/objfile2.go
+++ b/src/cmd/internal/obj/objfile2.go
@@ -428,7 +428,8 @@ func writeAuxSymDebug(ctxt *Link, par *LSym, aux *LSym) {
// Most aux symbols (ex: funcdata) are not interesting--
// pick out just the DWARF ones for now.
if aux.Type != objabi.SDWARFLOC &&
- aux.Type != objabi.SDWARFINFO &&
+ aux.Type != objabi.SDWARFFCN &&
+ aux.Type != objabi.SDWARFABSFCN &&
aux.Type != objabi.SDWARFLINES &&
aux.Type != objabi.SDWARFRANGE {
return