mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: add -dumpdep flag to dump linker dependency graph
This is what led to https://golang.org/cl/20763 and https://golang.org/cl/20765 to shrink binary sizes. Change-Id: Id360d474e6153cfe32a525b0a720810fd113195b Reviewed-on: https://go-review.googlesource.com/22392 Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
9e3c68f1e0
commit
d224e98d9a
3 changed files with 9 additions and 0 deletions
|
|
@ -196,6 +196,13 @@ func (d *deadcodepass) mark(s, parent *LSym) {
|
|||
if s.Attr.ReflectMethod() {
|
||||
d.reflectMethod = true
|
||||
}
|
||||
if flag_dumpdep {
|
||||
p := "_"
|
||||
if parent != nil {
|
||||
p = parent.Name
|
||||
}
|
||||
fmt.Printf("%s -> %s\n", p, s.Name)
|
||||
}
|
||||
s.Attr |= AttrReachable
|
||||
s.Reachparent = parent
|
||||
d.markQueue = append(d.markQueue, s)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue