]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: restore -dumpdep in new deadcode pass
authorCherry Zhang <cherryyz@google.com>
Sat, 2 Nov 2019 14:24:33 +0000 (10:24 -0400)
committerCherry Zhang <cherryyz@google.com>
Sun, 3 Nov 2019 04:57:50 +0000 (04:57 +0000)
Change-Id: I2e52206a95c9463df5661664726a8b3bbf3ad1fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/204825
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/deadcode2.go

index a138bc97fad97d84f0d5f29e0ef08d35f47745da..cb6bb05492ec98127b26f8115030c31f07a9cac5 100644 (file)
@@ -18,10 +18,6 @@ import (
 
 var _ = fmt.Print
 
-// TODO:
-// - Debug output:
-//   Emit messages about which symbols are kept or deleted.
-
 type workQueue []loader.Sym
 
 // Implement container/heap.Interface.
@@ -205,6 +201,16 @@ func (d *deadcodePass2) mark(symIdx, parent loader.Sym) {
                if d.ctxt.Reachparent != nil {
                        d.ldr.Reachparent[symIdx] = parent
                }
+               if *flagDumpDep {
+                       to := d.ldr.SymName(symIdx)
+                       if to != "" {
+                               from := "_"
+                               if parent != 0 {
+                                       from = d.ldr.SymName(parent)
+                               }
+                               fmt.Printf("%s -> %s\n", from, to)
+                       }
+               }
        }
 }