mirror of
https://github.com/golang/go
synced 2024-11-26 23:11:24 -07:00
cmd/link: print failed external command invocation
When the invocation of the external linker, dsymutil or strip command fails, print the command we invoked. For #65292. Change-Id: Icdb5f9ee942ebda4276f6373c3fbbf5222088d0b Reviewed-on: https://go-review.googlesource.com/c/go/+/558856 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Bryan Mills <bcmills@google.com>
This commit is contained in:
parent
8081c08449
commit
a428387e97
@ -1874,9 +1874,10 @@ func (ctxt *Link) hostlink() {
|
|||||||
ctxt.Logf("\n")
|
ctxt.Logf("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err := exec.Command(argv[0], argv[1:]...).CombinedOutput()
|
cmd := exec.Command(argv[0], argv[1:]...)
|
||||||
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exitf("running %s failed: %v\n%s", argv[0], err, out)
|
Exitf("running %s failed: %v\n%s\n%s", argv[0], err, cmd, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter out useless linker warnings caused by bugs outside Go.
|
// Filter out useless linker warnings caused by bugs outside Go.
|
||||||
@ -1959,7 +1960,7 @@ func (ctxt *Link) hostlink() {
|
|||||||
ctxt.Logf("\n")
|
ctxt.Logf("\n")
|
||||||
}
|
}
|
||||||
if out, err := cmd.CombinedOutput(); err != nil {
|
if out, err := cmd.CombinedOutput(); err != nil {
|
||||||
Exitf("%s: running dsymutil failed: %v\n%s", os.Args[0], err, out)
|
Exitf("%s: running dsymutil failed: %v\n%s\n%s", os.Args[0], err, cmd, out)
|
||||||
}
|
}
|
||||||
// Remove STAB (symbolic debugging) symbols after we are done with them (by dsymutil).
|
// Remove STAB (symbolic debugging) symbols after we are done with them (by dsymutil).
|
||||||
// They contain temporary file paths and make the build not reproducible.
|
// They contain temporary file paths and make the build not reproducible.
|
||||||
@ -1978,8 +1979,9 @@ func (ctxt *Link) hostlink() {
|
|||||||
}
|
}
|
||||||
ctxt.Logf("\n")
|
ctxt.Logf("\n")
|
||||||
}
|
}
|
||||||
if out, err := exec.Command(stripCmd, stripArgs...).CombinedOutput(); err != nil {
|
cmd = exec.Command(stripCmd, stripArgs...)
|
||||||
Exitf("%s: running strip failed: %v\n%s", os.Args[0], err, out)
|
if out, err := cmd.CombinedOutput(); err != nil {
|
||||||
|
Exitf("%s: running strip failed: %v\n%s\n%s", os.Args[0], err, cmd, out)
|
||||||
}
|
}
|
||||||
// Skip combining if `dsymutil` didn't generate a file. See #11994.
|
// Skip combining if `dsymutil` didn't generate a file. See #11994.
|
||||||
if _, err := os.Stat(dsym); os.IsNotExist(err) {
|
if _, err := os.Stat(dsym); os.IsNotExist(err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user