mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile,cmd/link: export int global consts to DWARF
Updates #14517 Change-Id: I23ef88e71c89da12dffcadf5562ea2d7557b62cf Reviewed-on: https://go-review.googlesource.com/61019 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
f366379d84
commit
9daee93121
6 changed files with 173 additions and 29 deletions
|
|
@ -499,3 +499,16 @@ func (ctxt *Link) populateDWARF(curfn interface{}, s *LSym) {
|
|||
ctxt.Diag("emitting DWARF for %s failed: %v", s.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
// DwarfIntConst creates a link symbol for an integer constant with the
|
||||
// given name, type and value.
|
||||
func (ctxt *Link) DwarfIntConst(myimportpath, name, typename string, val int64) {
|
||||
if myimportpath == "" {
|
||||
return
|
||||
}
|
||||
s := ctxt.LookupInit(dwarf.ConstInfoPrefix+myimportpath, func(s *LSym) {
|
||||
s.Type = objabi.SDWARFINFO
|
||||
ctxt.Data = append(ctxt.Data, s)
|
||||
})
|
||||
dwarf.PutIntConst(dwCtxt{ctxt}, s, ctxt.Lookup(dwarf.InfoPrefix+typename), myimportpath+"."+name, val)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue