From 39ecf13fd2e3026d5db2baf24c67f27e09589ea0 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 1e8250002eec..17fec9339355 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 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)