From c31a34018aa6c4f34102e8c5a93cc98def3b5a7b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 26 Jun 2019 00:04:36 +0000 Subject: [PATCH] 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. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183817 From-SVN: r272661 --- gcc/go/gofrontend/MERGE | 2 +- libgo/go/cmd/go/internal/work/gccgo.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index ca0578ab9d4..caa7bf91664 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -a857aad2f3994e6fa42a6fc65330e65d209597a0 +1d6578a20a9a2ee599a07f03cf7f8e7797d72b9c The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/cmd/go/internal/work/gccgo.go b/libgo/go/cmd/go/internal/work/gccgo.go index a0eb2d3a860..3b97209b752 100644 --- a/libgo/go/cmd/go/internal/work/gccgo.go +++ b/libgo/go/cmd/go/internal/work/gccgo.go @@ -209,9 +209,16 @@ func (tools gccgoToolchain) pack(b *Builder, a *Action, afile string, ofiles []s } 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 } -- 2.30.2