mirror of
https://github.com/golang/go
synced 2024-11-22 23:50:03 -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")
|
||||
}
|
||||
|
||||
out, err := exec.Command(argv[0], argv[1:]...).CombinedOutput()
|
||||
cmd := exec.Command(argv[0], argv[1:]...)
|
||||
out, err := cmd.CombinedOutput()
|
||||
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.
|
||||
@ -1959,7 +1960,7 @@ func (ctxt *Link) hostlink() {
|
||||
ctxt.Logf("\n")
|
||||
}
|
||||
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).
|
||||
// They contain temporary file paths and make the build not reproducible.
|
||||
@ -1978,8 +1979,9 @@ func (ctxt *Link) hostlink() {
|
||||
}
|
||||
ctxt.Logf("\n")
|
||||
}
|
||||
if out, err := exec.Command(stripCmd, stripArgs...).CombinedOutput(); err != nil {
|
||||
Exitf("%s: running strip failed: %v\n%s", os.Args[0], err, out)
|
||||
cmd = exec.Command(stripCmd, stripArgs...)
|
||||
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.
|
||||
if _, err := os.Stat(dsym); os.IsNotExist(err) {
|
||||
|
Loading…
Reference in New Issue
Block a user