cmd/go: silence ar with D flag failures
The first call of ar must not show its output in order to avoid useless
error messages about D flag.
The corresponding Go toolchain patch is CL 182077.
Change-Id: I3ac2c60909a95124adf6106c1246b5034918703d
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183817
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/libgo/go/cmd/go/internal/work/gccgo.go b/libgo/go/cmd/go/internal/work/gccgo.go
index a0eb2d3..3b97209 100644
--- a/libgo/go/cmd/go/internal/work/gccgo.go
+++ b/libgo/go/cmd/go/internal/work/gccgo.go
@@ -209,9 +209,16 @@
}
absAfile := mkAbs(objdir, afile)
// Try with D modifier first, then without if that fails.
- if b.run(a, p.Dir, p.ImportPath, nil, tools.ar(), arArgs, "rcD", absAfile, absOfiles) != nil {
+ output, err := b.runOut(p.Dir, nil, tools.ar(), arArgs, "rcD", absAfile, absOfiles)
+ if err != nil {
return b.run(a, p.Dir, p.ImportPath, nil, tools.ar(), arArgs, "rc", absAfile, absOfiles)
}
+
+ if len(output) > 0 {
+ // Show the output if there is any even without errors.
+ b.showOutput(a, p.Dir, p.ImportPath, b.processOutput(output))
+ }
+
return nil
}