aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/ld/deadcode.go
diff options
context:
space:
mode:
authorDavid Crawshaw <crawshaw@golang.org>2017-10-05 10:20:17 -0400
committerDavid Crawshaw <crawshaw@golang.org>2017-10-06 13:49:11 +0000
commit2e8545531e759a47bbb2c1f9fefa54bafbcf02e5 (patch)
tree4c3b25a56f0d6b4d125cc06af6d136e886a9d9cc /src/cmd/link/internal/ld/deadcode.go
parent9f9bb9742080f4ca795e8c255ad381f0b6110f84 (diff)
downloadgo-2e8545531e759a47bbb2c1f9fefa54bafbcf02e5.tar.xz
cmd/link: move build/link mode globals into ctxt
Replace Buildmode with BuildMode and Linkmode with LinkMode. For #22095 Change-Id: I51a6f5719d107727bca29ec8e68e3e9d87e31e33 Reviewed-on: https://go-review.googlesource.com/68334 Run-TryBot: David Crawshaw <crawshaw@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/link/internal/ld/deadcode.go')
-rw-r--r--src/cmd/link/internal/ld/deadcode.go12
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 00a076f224..ad518adc3f 100644
--- a/src/cmd/link/internal/ld/deadcode.go
+++ b/src/cmd/link/internal/ld/deadcode.go
@@ -108,9 +108,9 @@ func deadcode(ctxt *Link) {
}
}
- if Buildmode != BuildmodeShared {
+ if ctxt.BuildMode != BuildModeShared {
// Keep a itablink if the symbol it points at is being kept.
- // (When BuildmodeShared, always keep itablinks.)
+ // (When BuildModeShared, always keep itablinks.)
for _, s := range ctxt.Syms.Allsym {
if strings.HasPrefix(s.Name, "go.itablink.") {
s.Attr.Set(sym.AttrReachable, len(s.R) == 1 && s.R[0].Sym.Attr.Reachable())
@@ -205,7 +205,7 @@ func (d *deadcodepass) init() {
names = append(names, "runtime.read_tls_fallback")
}
- if Buildmode == BuildmodeShared {
+ if d.ctxt.BuildMode == BuildModeShared {
// Mark all symbols defined in this library as reachable when
// building a shared library.
for _, s := range d.ctxt.Syms.Allsym {
@@ -217,11 +217,11 @@ func (d *deadcodepass) init() {
// In a normal binary, start at main.main and the init
// functions and mark what is reachable from there.
- if *FlagLinkshared && (Buildmode == BuildmodeExe || Buildmode == BuildmodePIE) {
+ if *FlagLinkshared && (d.ctxt.BuildMode == BuildModeExe || d.ctxt.BuildMode == BuildModePIE) {
names = append(names, "main.main", "main.init")
} else {
// The external linker refers main symbol directly.
- if Linkmode == LinkExternal && (Buildmode == BuildmodeExe || Buildmode == BuildmodePIE) {
+ if d.ctxt.LinkMode == LinkExternal && (d.ctxt.BuildMode == BuildModeExe || d.ctxt.BuildMode == BuildModePIE) {
if Headtype == objabi.Hwindows && d.ctxt.Arch.Family == sys.I386 {
*flagEntrySymbol = "_main"
} else {
@@ -229,7 +229,7 @@ func (d *deadcodepass) init() {
}
}
names = append(names, *flagEntrySymbol)
- if Buildmode == BuildmodePlugin {
+ if d.ctxt.BuildMode == BuildModePlugin {
names = append(names, *flagPluginPath+".init", *flagPluginPath+".main", "go.plugin.tabs")
// We don't keep the go.plugin.exports symbol,