From e946cd79e9a7d5c327999700ef15353e5a127515 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 36b3f4b05a0..1116206b341 100644 --- a/libgo/go/cmd/go/internal/work/gccgo.go +++ b/libgo/go/cmd/go/internal/work/gccgo.go @@ -48,7 +48,7 @@ func (gccgoToolchain) linker() string { func (gccgoToolchain) ar() string { ar := cfg.Getenv("AR") if ar == "" { - ar = "ar" + ar = "/usr/bin/gar" } return ar } diff --git a/libgo/go/go/internal/gccgoimporter/importer_test.go b/libgo/go/go/internal/gccgoimporter/importer_test.go index 35240c8fe68..65bdb63810c 100644 --- a/libgo/go/go/internal/gccgoimporter/importer_test.go +++ b/libgo/go/go/internal/gccgoimporter/importer_test.go @@ -190,7 +190,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)