From c4650640675629f52f985217050fd68fa9043b23 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 4 May 2018 15:29:09 -0700 Subject: [PATCH] cmd/go: for gccgo, don't edit cgo header when using -o This change was made to the gccgo sources as part of CL 47037. It is required to make the testcarchive and testcshared tests work. Otherwise using `go build -mode=c-archive -o libgo.a` will cause the header file to be named go.h rather than libgo.h. Change-Id: I2db1d7b0f575368b31273cc01097447a0471efd6 Reviewed-on: https://go-review.googlesource.com/111615 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Than McIntosh --- src/cmd/go/internal/work/action.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/go/internal/work/action.go b/src/cmd/go/internal/work/action.go index 8b53fad19ab..c83fe4e58d2 100644 --- a/src/cmd/go/internal/work/action.go +++ b/src/cmd/go/internal/work/action.go @@ -588,7 +588,7 @@ func (b *Builder) addInstallHeaderAction(a *Action) { p := a.Package if p.UsesCgo() && (cfg.BuildBuildmode == "c-archive" || cfg.BuildBuildmode == "c-shared") { hdrTarget := a.Target[:len(a.Target)-len(filepath.Ext(a.Target))] + ".h" - if cfg.BuildContext.Compiler == "gccgo" { + if cfg.BuildContext.Compiler == "gccgo" && cfg.BuildO == "" { // For the header file, remove the "lib" // added by go/build, so we generate pkg.h // rather than libpkg.h.