From 43267255a1de2e115be5391a1463a4ae99020289 Mon Sep 17 00:00:00 2001 From: Petr Sumbera Date: Wed, 13 Nov 2019 18:05:21 +0000 Subject: [PATCH 26/34] 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 63d5c624f79..4ed59248bf5 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 { 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 a74a4568680..51d57555d16 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) -- 2.31.1