mirror of
https://github.com/golang/go
synced 2024-11-19 22:04:44 -07:00
cmd/link: fix some unintentional symbol creation
There are two places in DWARF generation that create symbols when they really just want to get the symbol if it exists. writeranges, in particular, will create a DWARF range symbol for every single textp symbol (though they won't get linked into any list, so they don't affect the binary). Fix these to use ROLookup instead of Lookup. Change-Id: I401eadf22890e296bd08bccaa6ba2fd8fac800cd Reviewed-on: https://go-review.googlesource.com/69971 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
371eda4558
commit
e29efbcbcb
@ -1273,8 +1273,8 @@ func writeframes(ctxt *Link, syms []*sym.Symbol) []*sym.Symbol {
|
||||
func writeranges(ctxt *Link, syms []*sym.Symbol) []*sym.Symbol {
|
||||
empty := true
|
||||
for _, s := range ctxt.Textp {
|
||||
rangeSym := ctxt.Syms.Lookup(dwarf.RangePrefix+s.Name, int(s.Version))
|
||||
if rangeSym.Size == 0 {
|
||||
rangeSym := ctxt.Syms.ROLookup(dwarf.RangePrefix+s.Name, int(s.Version))
|
||||
if rangeSym == nil || rangeSym.Size == 0 {
|
||||
continue
|
||||
}
|
||||
rangeSym.Attr |= sym.AttrReachable | sym.AttrNotInSymbolTable
|
||||
@ -1555,7 +1555,7 @@ func dwarfgeneratedebugsyms(ctxt *Link) {
|
||||
|
||||
var consts []*sym.Symbol
|
||||
for _, lib := range ctxt.Library {
|
||||
if s := ctxt.Syms.Lookup(dwarf.ConstInfoPrefix+lib.Pkg, 0); s != nil {
|
||||
if s := ctxt.Syms.ROLookup(dwarf.ConstInfoPrefix+lib.Pkg, 0); s != nil {
|
||||
importInfoSymbol(ctxt, s)
|
||||
consts = append(consts, s)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user