1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:55:01 -07:00

[dev.link] cmd/link: tweak genasmsym to eliminate Gotype ref

None of the users of genasmsym are doing anything with the Gotype
field of sym.Symbol, so remove that param from the callback function.

Change-Id: Ie902c4cdbcc6b68d353daf5ce21a99012161a946
Reviewed-on: https://go-review.googlesource.com/c/go/+/230545
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Than McIntosh 2020-04-28 13:45:35 -04:00
parent dd34841de7
commit 0612e78f0f
4 changed files with 15 additions and 15 deletions

View File

@ -2493,7 +2493,7 @@ const (
DeletedAutoSym = 'x'
)
func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int64, *sym.Symbol)) {
func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int64)) {
// These symbols won't show up in the first loop below because we
// skip sym.STEXT symbols. Normal sym.STEXT symbols are emitted by walking textp.
s := ctxt.Syms.Lookup("runtime.text", 0)
@ -2503,7 +2503,7 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
// on AIX with external linker.
// See data.go:/textaddress
if !(ctxt.DynlinkingGo() && ctxt.HeadType == objabi.Hdarwin) && !(ctxt.HeadType == objabi.Haix && ctxt.LinkMode == LinkExternal) {
put(ctxt, s, s.Name, TextSym, s.Value, nil)
put(ctxt, s, s.Name, TextSym, s.Value)
}
}
@ -2524,7 +2524,7 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
break
}
if s.Type == sym.STEXT {
put(ctxt, s, s.Name, TextSym, s.Value, nil)
put(ctxt, s, s.Name, TextSym, s.Value)
}
n++
}
@ -2536,7 +2536,7 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
// on AIX with external linker.
// See data.go:/textaddress
if !(ctxt.DynlinkingGo() && ctxt.HeadType == objabi.Hdarwin) && !(ctxt.HeadType == objabi.Haix && ctxt.LinkMode == LinkExternal) {
put(ctxt, s, s.Name, TextSym, s.Value, nil)
put(ctxt, s, s.Name, TextSym, s.Value)
}
}
@ -2589,7 +2589,7 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
if !s.Attr.Reachable() {
continue
}
put(ctxt, s, s.Name, DataSym, Symaddr(s), s.Gotype)
put(ctxt, s, s.Name, DataSym, Symaddr(s))
case sym.SBSS, sym.SNOPTRBSS, sym.SLIBFUZZER_EXTRA_COUNTER:
if !s.Attr.Reachable() {
@ -2598,11 +2598,11 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
if len(s.P) > 0 {
Errorf(s, "should not be bss (size=%d type=%v special=%v)", len(s.P), s.Type, s.Attr.Special())
}
put(ctxt, s, s.Name, BSSSym, Symaddr(s), s.Gotype)
put(ctxt, s, s.Name, BSSSym, Symaddr(s))
case sym.SUNDEFEXT:
if ctxt.HeadType == objabi.Hwindows || ctxt.HeadType == objabi.Haix || ctxt.IsELF {
put(ctxt, s, s.Name, UndefinedSym, s.Value, nil)
put(ctxt, s, s.Name, UndefinedSym, s.Value)
}
case sym.SHOSTOBJ:
@ -2610,24 +2610,24 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
continue
}
if ctxt.HeadType == objabi.Hwindows || ctxt.IsELF {
put(ctxt, s, s.Name, UndefinedSym, s.Value, nil)
put(ctxt, s, s.Name, UndefinedSym, s.Value)
}
case sym.SDYNIMPORT:
if !s.Attr.Reachable() {
continue
}
put(ctxt, s, s.Extname(), UndefinedSym, 0, nil)
put(ctxt, s, s.Extname(), UndefinedSym, 0)
case sym.STLSBSS:
if ctxt.LinkMode == LinkExternal {
put(ctxt, s, s.Name, TLSSym, Symaddr(s), s.Gotype)
put(ctxt, s, s.Name, TLSSym, Symaddr(s))
}
}
}
for _, s := range ctxt.Textp {
put(ctxt, s, s.Name, TextSym, s.Value, s.Gotype)
put(ctxt, s, s.Name, TextSym, s.Value)
}
if ctxt.Debugvlog != 0 || *flagN {

View File

@ -646,7 +646,7 @@ func (f *peFile) mapToPESection(s *sym.Symbol, linkmode LinkMode) (pesectidx int
// writeSymbols writes all COFF symbol table records.
func (f *peFile) writeSymbols(ctxt *Link) {
put := func(ctxt *Link, s *sym.Symbol, name string, type_ SymbolType, addr int64, gotype *sym.Symbol) {
put := func(ctxt *Link, s *sym.Symbol, name string, type_ SymbolType, addr int64) {
if s == nil {
return
}

View File

@ -74,7 +74,7 @@ func putelfsyment(out *OutBuf, off int, addr int64, size int64, info int, shndx
}
}
func putelfsym(ctxt *Link, x *sym.Symbol, s string, t SymbolType, addr int64, go_ *sym.Symbol) {
func putelfsym(ctxt *Link, x *sym.Symbol, s string, t SymbolType, addr int64) {
var typ int
switch t {
@ -224,7 +224,7 @@ func Asmelfsym(ctxt *Link) {
genasmsym(ctxt, putelfsym)
}
func putplan9sym(ctxt *Link, x *sym.Symbol, s string, typ SymbolType, addr int64, go_ *sym.Symbol) {
func putplan9sym(ctxt *Link, x *sym.Symbol, s string, typ SymbolType, addr int64) {
t := int(typ)
switch typ {
case TextSym, DataSym, BSSSym:

View File

@ -855,7 +855,7 @@ func (f *xcoffFile) writeSymbolFunc(ctxt *Link, x *sym.Symbol) []xcoffSym {
}
// put function used by genasmsym to write symbol table
func putaixsym(ctxt *Link, x *sym.Symbol, str string, t SymbolType, addr int64, go_ *sym.Symbol) {
func putaixsym(ctxt *Link, x *sym.Symbol, str string, t SymbolType, addr int64) {
// All XCOFF symbols generated by this GO symbols
// Can be a symbol entry or a auxiliary entry