]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile,cmd/asm: dump sym ABI versions for -S=2
authorThan McIntosh <thanm@google.com>
Thu, 17 Sep 2020 19:35:31 +0000 (15:35 -0400)
committerThan McIntosh <thanm@google.com>
Thu, 17 Sep 2020 23:22:34 +0000 (23:22 +0000)
When -S=2 is in effect for the compiler/assembler, include symbol ABI
values for defined symbols and relocations. This is intended to help
make it easier to distinguish between a symbol and its ABI wrapper.

Change-Id: Ifbf71372392075f15363b40e882b2132406b7d6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/255718
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/internal/obj/objfile.go

index 7bc4f4992e93a06daa5194a69ba6534dcd674a83..aede5fe71c70d2e340c6af182be2743d90d39c4b 100644 (file)
@@ -663,7 +663,11 @@ func (ctxt *Link) writeSymDebug(s *LSym) {
 }
 
 func (ctxt *Link) writeSymDebugNamed(s *LSym, name string) {
-       fmt.Fprintf(ctxt.Bso, "%s ", name)
+       ver := ""
+       if ctxt.Debugasm > 1 {
+               ver = fmt.Sprintf("<%d>", s.ABI())
+       }
+       fmt.Fprintf(ctxt.Bso, "%s%s ", name, ver)
        if s.Type != 0 {
                fmt.Fprintf(ctxt.Bso, "%v ", s.Type)
        }
@@ -726,15 +730,19 @@ func (ctxt *Link) writeSymDebugNamed(s *LSym, name string) {
        sort.Sort(relocByOff(s.R)) // generate stable output
        for _, r := range s.R {
                name := ""
+               ver := ""
                if r.Sym != nil {
                        name = r.Sym.Name
+                       if ctxt.Debugasm > 1 {
+                               ver = fmt.Sprintf("<%d>", s.ABI())
+                       }
                } else if r.Type == objabi.R_TLS_LE {
                        name = "TLS"
                }
                if ctxt.Arch.InFamily(sys.ARM, sys.PPC64) {
-                       fmt.Fprintf(ctxt.Bso, "\trel %d+%d t=%d %s+%x\n", int(r.Off), r.Siz, r.Type, name, uint64(r.Add))
+                       fmt.Fprintf(ctxt.Bso, "\trel %d+%d t=%d %s%s+%x\n", int(r.Off), r.Siz, r.Type, name, ver, uint64(r.Add))
                } else {
-                       fmt.Fprintf(ctxt.Bso, "\trel %d+%d t=%d %s+%d\n", int(r.Off), r.Siz, r.Type, name, r.Add)
+                       fmt.Fprintf(ctxt.Bso, "\trel %d+%d t=%d %s%s+%d\n", int(r.Off), r.Siz, r.Type, name, ver, r.Add)
                }
        }
 }