diff options
| author | Michael Matloob <matloob@golang.org> | 2016-08-21 18:34:24 -0400 |
|---|---|---|
| committer | Michael Matloob <matloob@golang.org> | 2016-08-22 14:09:05 +0000 |
| commit | fa8a28d55940adbf797e54a9ca6fa68f1e341a93 (patch) | |
| tree | 96a87f8c19e9f1502429c9e0504d8038078b5064 /src/cmd/link/internal/ld/deadcode.go | |
| parent | 236901384dc9fc3d7810ae96b43c8404f0fea6c1 (diff) | |
| download | go-fa8a28d55940adbf797e54a9ca6fa68f1e341a93.tar.xz | |
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 <crawshaw@golang.org>
Diffstat (limited to 'src/cmd/link/internal/ld/deadcode.go')
| -rw-r--r-- | src/cmd/link/internal/ld/deadcode.go | 12 |
1 files changed, 6 insertions, 6 deletions
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 { |
