From c6621d9241c1835806fbc85ca9893d90af035fc4 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Sat, 2 Nov 2019 10:24:33 -0400 Subject: [PATCH] [dev.link] cmd/link: restore -dumpdep in new deadcode pass Change-Id: I2e52206a95c9463df5661664726a8b3bbf3ad1fc Reviewed-on: https://go-review.googlesource.com/c/go/+/204825 Reviewed-by: Than McIntosh --- src/cmd/link/internal/ld/deadcode2.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/cmd/link/internal/ld/deadcode2.go b/src/cmd/link/internal/ld/deadcode2.go index a138bc97fa..cb6bb05492 100644 --- a/src/cmd/link/internal/ld/deadcode2.go +++ b/src/cmd/link/internal/ld/deadcode2.go @@ -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) + } + } } } -- 2.48.1