From fa8a28d55940adbf797e54a9ca6fa68f1e341a93 Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Sun, 21 Aug 2016 18:34:24 -0400 Subject: cmd/link: turn some globals into flag pointer variables This moves many of the flag globals into main and assigns them to their flag.String/Int64/... directly. Updates #16818 Change-Id: Ibbff44a273bbc5cb7228e43f147900ee8848517f Reviewed-on: https://go-review.googlesource.com/27473 Reviewed-by: David Crawshaw --- src/cmd/link/internal/ld/deadcode.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/cmd/link/internal/ld/deadcode.go') diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go index 36ed60344c..4fd35e1513 100644 --- a/src/cmd/link/internal/ld/deadcode.go +++ b/src/cmd/link/internal/ld/deadcode.go @@ -15,7 +15,7 @@ import ( // deadcode marks all reachable symbols. // // The basis of the dead code elimination is a flood fill of symbols, -// following their relocations, beginning at INITENTRY. +// following their relocations, beginning at *flagEntrySymbol. // // This flood fill is wrapped in logic for pruning unused methods. // All methods are mentioned by relocations on their receiver's *rtype. @@ -55,7 +55,7 @@ func deadcode(ctxt *Link) { } // First, flood fill any symbols directly reachable in the call - // graph from INITENTRY. Ignore all methods not directly called. + // graph from *flagEntrySymbol. Ignore all methods not directly called. d.init() d.flood() @@ -196,7 +196,7 @@ func (d *deadcodepass) mark(s, parent *Symbol) { if s.Attr.ReflectMethod() { d.reflectMethod = true } - if flag_dumpdep { + if *flagDumpDep { p := "_" if parent != nil { p = parent.Name @@ -217,7 +217,7 @@ func (d *deadcodepass) markMethod(m methodref) { } // init marks all initial symbols as reachable. -// In a typical binary, this is INITENTRY. +// In a typical binary, this is *flagEntrySymbol. func (d *deadcodepass) init() { var names []string @@ -240,8 +240,8 @@ func (d *deadcodepass) init() { } else { // In a normal binary, start at main.main and the init // functions and mark what is reachable from there. - names = append(names, INITENTRY) - if Linkshared && Buildmode == BuildmodeExe { + names = append(names, *flagEntrySymbol) + if *FlagLinkshared && Buildmode == BuildmodeExe { names = append(names, "main.main", "main.init") } for _, name := range markextra { -- cgit v1.3-5-g9baa