]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/internal/obj: remove asm parameter of NumberSyms
authorCherry Zhang <cherryyz@google.com>
Mon, 18 May 2020 22:47:17 +0000 (18:47 -0400)
committerCherry Zhang <cherryyz@google.com>
Tue, 19 May 2020 14:54:09 +0000 (14:54 +0000)
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>
src/cmd/asm/main.go
src/cmd/compile/internal/gc/main.go
src/cmd/internal/obj/sym.go

index 4a5dfecf6d9e2af3e4d34da50870df2f303bad99..31d8549d2d49a3d799385ac7c05dd1b101c21e27 100644 (file)
@@ -96,7 +96,7 @@ func main() {
                }
        }
        if ok && !*flags.SymABIs {
-               ctxt.NumberSyms(true)
+               ctxt.NumberSyms()
                obj.WriteObjFile(ctxt, buf, *flags.Importpath)
        }
        if !ok || diag {
index ba40582f4f0c2d7c5cd364d15c15c892af849a6e..b258952457b87d42124951c35b203a091d94fd82 100644 (file)
@@ -789,7 +789,7 @@ func Main(archInit func(*Arch)) {
        // Write object data to disk.
        timings.Start("be", "dumpobj")
        dumpdata()
-       Ctxt.NumberSyms(false)
+       Ctxt.NumberSyms()
        dumpobj()
        if asmhdr != "" {
                dumpasmhdr()
index 61ef6ff2ce796de9e5c9d538fe3e18146863c5ba..4cbcb87b4899be6cb6f335e671a0190dab5ddd00 100644 (file)
@@ -164,7 +164,7 @@ func (ctxt *Link) Int64Sym(i int64) *LSym {
 // Assign index to symbols.
 // 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).
-func (ctxt *Link) NumberSyms(asm bool) {
+func (ctxt *Link) NumberSyms() {
        if ctxt.Headtype == objabi.Haix {
                // Data must be sorted to keep a constant order in TOC symbols.
                // 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
        ctxt.traverseSyms(traverseDefs, func(s *LSym) {
-               if isNonPkgSym(ctxt, asm, s) {
+               if isNonPkgSym(ctxt, s) {
                        s.PkgIdx = goobj2.PkgIdxNone
                        s.SymIdx = nonpkgidx
                        if nonpkgidx != int32(len(ctxt.nonpkgdefs)) {
@@ -240,7 +240,7 @@ func (ctxt *Link) NumberSyms(asm bool) {
        })
 
        // Compute a fingerprint of the indices, for exporting.
-       if !asm {
+       if !ctxt.IsAsm {
                h := md5.New()
                for _, s := range ctxt.defs {
                        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
 // by name instead of by index.
-func isNonPkgSym(ctxt *Link, asm bool, s *LSym) bool {
-       if asm && !s.Static() {
+func isNonPkgSym(ctxt *Link, s *LSym) bool {
+       if ctxt.IsAsm && !s.Static() {
                // asm symbols are referenced by name only, except static symbols
                // which are file-local and can be referenced by index.
                return true