[dev.link] cmd/internal/obj: remove asm parameter of NumberSyms

Now we have ctxt.IsAsm, use that, instead of passing in a
parameter.

Change-Id: I81dedbe6459424fa9a4c2bfbd9abd83d83f3a107
Reviewed-on: https://go-review.googlesource.com/c/go/+/234492
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Cherry Zhang 2020-05-18 18:47:17 -04:00
parent 0f92cd75cf
commit cf3bf9959c
3 changed files with 7 additions and 7 deletions

View file

@ -96,7 +96,7 @@ func main() {
} }
} }
if ok && !*flags.SymABIs { if ok && !*flags.SymABIs {
ctxt.NumberSyms(true) ctxt.NumberSyms()
obj.WriteObjFile(ctxt, buf, *flags.Importpath) obj.WriteObjFile(ctxt, buf, *flags.Importpath)
} }
if !ok || diag { if !ok || diag {

View file

@ -789,7 +789,7 @@ func Main(archInit func(*Arch)) {
// Write object data to disk. // Write object data to disk.
timings.Start("be", "dumpobj") timings.Start("be", "dumpobj")
dumpdata() dumpdata()
Ctxt.NumberSyms(false) Ctxt.NumberSyms()
dumpobj() dumpobj()
if asmhdr != "" { if asmhdr != "" {
dumpasmhdr() dumpasmhdr()

View file

@ -164,7 +164,7 @@ func (ctxt *Link) Int64Sym(i int64) *LSym {
// Assign index to symbols. // Assign index to symbols.
// asm is set to true if this is called by the assembler (i.e. not the compiler), // asm is set to true if this is called by the assembler (i.e. not the compiler),
// in which case all the symbols are non-package (for now). // in which case all the symbols are non-package (for now).
func (ctxt *Link) NumberSyms(asm bool) { func (ctxt *Link) NumberSyms() {
if ctxt.Headtype == objabi.Haix { if ctxt.Headtype == objabi.Haix {
// Data must be sorted to keep a constant order in TOC symbols. // Data must be sorted to keep a constant order in TOC symbols.
// As they are created during Progedit, two symbols can be switched between // As they are created during Progedit, two symbols can be switched between
@ -181,7 +181,7 @@ func (ctxt *Link) NumberSyms(asm bool) {
var idx, nonpkgidx int32 = 0, 0 var idx, nonpkgidx int32 = 0, 0
ctxt.traverseSyms(traverseDefs, func(s *LSym) { ctxt.traverseSyms(traverseDefs, func(s *LSym) {
if isNonPkgSym(ctxt, asm, s) { if isNonPkgSym(ctxt, s) {
s.PkgIdx = goobj2.PkgIdxNone s.PkgIdx = goobj2.PkgIdxNone
s.SymIdx = nonpkgidx s.SymIdx = nonpkgidx
if nonpkgidx != int32(len(ctxt.nonpkgdefs)) { if nonpkgidx != int32(len(ctxt.nonpkgdefs)) {
@ -240,7 +240,7 @@ func (ctxt *Link) NumberSyms(asm bool) {
}) })
// Compute a fingerprint of the indices, for exporting. // Compute a fingerprint of the indices, for exporting.
if !asm { if !ctxt.IsAsm {
h := md5.New() h := md5.New()
for _, s := range ctxt.defs { for _, s := range ctxt.defs {
h.Write([]byte(s.Name)) h.Write([]byte(s.Name))
@ -251,8 +251,8 @@ func (ctxt *Link) NumberSyms(asm bool) {
// Returns whether s is a non-package symbol, which needs to be referenced // Returns whether s is a non-package symbol, which needs to be referenced
// by name instead of by index. // by name instead of by index.
func isNonPkgSym(ctxt *Link, asm bool, s *LSym) bool { func isNonPkgSym(ctxt *Link, s *LSym) bool {
if asm && !s.Static() { if ctxt.IsAsm && !s.Static() {
// asm symbols are referenced by name only, except static symbols // asm symbols are referenced by name only, except static symbols
// which are file-local and can be referenced by index. // which are file-local and can be referenced by index.
return true return true