cmd/go: rename ld, ldShared "out" argument to "targetPath"

"out" is often used for stdout or stderr. Rename it to targetPath to
clarify its meaning.

Change-Id: I95823e9119843a7026dc26c192497776ee4219e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/534595
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Austin Clements <austin@google.com>
This commit is contained in:
Austin Clements 2023-10-11 12:31:55 -04:00 committed by Gopher Robot
parent aa05674b1d
commit 408b31dcc5
3 changed files with 13 additions and 13 deletions

View File

@ -2550,9 +2550,9 @@ type toolchain interface {
// typically it is run in the object directory.
pack(b *Builder, a *Action, afile string, ofiles []string) error
// ld runs the linker to create an executable starting at mainpkg.
ld(b *Builder, root *Action, out, importcfg, mainpkg string) error
ld(b *Builder, root *Action, targetPath, importcfg, mainpkg string) error
// ldShared runs the linker to create a shared library containing the pkgs built by toplevelactions
ldShared(b *Builder, root *Action, toplevelactions []*Action, out, importcfg string, allactions []*Action) error
ldShared(b *Builder, root *Action, toplevelactions []*Action, targetPath, importcfg string, allactions []*Action) error
compiler() string
linker() string
@ -2591,11 +2591,11 @@ func (noToolchain) pack(b *Builder, a *Action, afile string, ofiles []string) er
return noCompiler()
}
func (noToolchain) ld(b *Builder, root *Action, out, importcfg, mainpkg string) error {
func (noToolchain) ld(b *Builder, root *Action, targetPath, importcfg, mainpkg string) error {
return noCompiler()
}
func (noToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, out, importcfg string, allactions []*Action) error {
func (noToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, targetPath, importcfg string, allactions []*Action) error {
return noCompiler()
}

View File

@ -572,7 +572,7 @@ func pluginPath(a *Action) string {
return fmt.Sprintf("plugin/unnamed-%x", h.Sum(nil))
}
func (gcToolchain) ld(b *Builder, root *Action, out, importcfg, mainpkg string) error {
func (gcToolchain) ld(b *Builder, root *Action, targetPath, importcfg, mainpkg string) error {
cxx := len(root.Package.CXXFiles) > 0 || len(root.Package.SwigCXXFiles) > 0
for _, a := range root.Deps {
if a.Package != nil && (len(a.Package.CXXFiles) > 0 || len(a.Package.SwigCXXFiles) > 0) {
@ -641,17 +641,17 @@ func (gcToolchain) ld(b *Builder, root *Action, out, importcfg, mainpkg string)
// the output file path is recorded in the .gnu.version_d section.
dir := "."
if cfg.BuildBuildmode == "c-shared" || cfg.BuildBuildmode == "plugin" {
dir, out = filepath.Split(out)
dir, targetPath = filepath.Split(targetPath)
}
env := []string{}
if cfg.BuildTrimpath {
env = append(env, "GOROOT_FINAL="+trimPathGoRootFinal)
}
return b.run(root, dir, root.Package.ImportPath, env, cfg.BuildToolexec, base.Tool("link"), "-o", out, "-importcfg", importcfg, ldflags, mainpkg)
return b.run(root, dir, root.Package.ImportPath, env, cfg.BuildToolexec, base.Tool("link"), "-o", targetPath, "-importcfg", importcfg, ldflags, mainpkg)
}
func (gcToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, out, importcfg string, allactions []*Action) error {
func (gcToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, targetPath, importcfg string, allactions []*Action) error {
ldflags := []string{"-installsuffix", cfg.BuildContext.InstallSuffix}
ldflags = append(ldflags, "-buildmode=shared")
ldflags = append(ldflags, forcedLdflags...)
@ -682,7 +682,7 @@ func (gcToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action,
}
ldflags = append(ldflags, d.Package.ImportPath+"="+d.Target)
}
return b.run(root, ".", out, nil, cfg.BuildToolexec, base.Tool("link"), "-o", out, "-importcfg", importcfg, ldflags)
return b.run(root, ".", targetPath, nil, cfg.BuildToolexec, base.Tool("link"), "-o", targetPath, "-importcfg", importcfg, ldflags)
}
func (gcToolchain) cc(b *Builder, a *Action, ofile, cfile string) error {

View File

@ -530,12 +530,12 @@ func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string
return nil
}
func (tools gccgoToolchain) ld(b *Builder, root *Action, out, importcfg, mainpkg string) error {
return tools.link(b, root, out, importcfg, root.Deps, ldBuildmode, root.Package.ImportPath)
func (tools gccgoToolchain) ld(b *Builder, root *Action, targetPath, importcfg, mainpkg string) error {
return tools.link(b, root, targetPath, importcfg, root.Deps, ldBuildmode, root.Package.ImportPath)
}
func (tools gccgoToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, out, importcfg string, allactions []*Action) error {
return tools.link(b, root, out, importcfg, allactions, "shared", out)
func (tools gccgoToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, targetPath, importcfg string, allactions []*Action) error {
return tools.link(b, root, targetPath, importcfg, allactions, "shared", targetPath)
}
func (tools gccgoToolchain) cc(b *Builder, a *Action, ofile, cfile string) error {