From 26bc56883760995d3cb2d718fc68eec686920deb Mon Sep 17 00:00:00 2001 From: Petr Sumbera Date: Wed, 13 Nov 2019 18:05:21 +0000 Subject: gccgo should use GNU ar Fix following error message: $ /usr/gcc/9/bin/go build main.go ar: bad option: -D usage: ar -d [-SvV] archive [file...] ar -m [-SvV] [-{a|b|i} posname] archive [file...] ar -p [-sSvV] archive [file ...] ar -q [-cSvV] archive [file...] ar -r [-cSuvV] [-{a|b|i} posname] archive [file...] ar -t [-sSvV] archive [file...] ar -x [-CsSTvV] archive [file...] ar [-sSvV] archive The error is harmless, no functionality issue, GCCGO runs Solaris "ar" which doesn't know -D option, after failure, GCCGO runs it again without -D. --- libgo/go/cmd/go/internal/work/gccgo.go | 2 +- libgo/go/go/internal/gccgoimporter/importer_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libgo/go/cmd/go/internal/work/gccgo.go b/libgo/go/cmd/go/internal/work/gccgo.go index 3e07f8791ebc..23954e0a3def 100644 --- a/libgo/go/cmd/go/internal/work/gccgo.go +++ b/libgo/go/cmd/go/internal/work/gccgo.go @@ -46,7 +46,7 @@ func (gccgoToolchain) linker() string { } func (gccgoToolchain) ar() []string { - return envList("AR", "ar") + return envList("AR", "/usr/bin/gar") } func checkGccgoBin() { diff --git a/libgo/go/go/internal/gccgoimporter/importer_test.go b/libgo/go/go/internal/gccgoimporter/importer_test.go index 8a7ee1aa4ffa..fecf18111709 100644 --- a/libgo/go/go/internal/gccgoimporter/importer_test.go +++ b/libgo/go/go/internal/gccgoimporter/importer_test.go @@ -180,7 +180,7 @@ func TestObjImporter(t *testing.T) { runImporterTest(t, imp, initmap, &test) - cmd = exec.Command("ar", "cr", afile, ofile) + cmd = exec.Command("/usr/bin/gar", "cr", afile, ofile) out, err = cmd.CombinedOutput() if err != nil { t.Logf("%s", out)