1
0
mirror of https://github.com/golang/go synced 2024-11-17 18:34:44 -07:00

cmd/go: check for another GCC error message

GCC always recognizes the -fsplit-stack option, but then tests whether
it is supported by the selected target. If not, it reports
    cc1: error: ‘-fsplit-stack’ is not supported by this compiler configuration
Check for that error message when deciding whether a compiler option works.

Change-Id: I2eef8d550bbecba3a087869df2c7351280c77290
Reviewed-on: https://go-review.googlesource.com/87136
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Ian Lance Taylor 2018-01-10 06:28:59 -08:00
parent 37d56279c8
commit f7d8098a7b

View File

@ -1849,9 +1849,11 @@ func (b *Builder) gccSupportsFlag(compiler []string, flag string) bool {
// GCC says "unrecognized command line option". // GCC says "unrecognized command line option".
// clang says "unknown argument". // clang says "unknown argument".
// Older versions of GCC say "unrecognised debug output level". // Older versions of GCC say "unrecognised debug output level".
// For -fsplit-stack GCC says "'-fsplit-stack' is not supported".
supported := !bytes.Contains(out, []byte("unrecognized")) && supported := !bytes.Contains(out, []byte("unrecognized")) &&
!bytes.Contains(out, []byte("unknown")) && !bytes.Contains(out, []byte("unknown")) &&
!bytes.Contains(out, []byte("unrecognised")) !bytes.Contains(out, []byte("unrecognised")) &&
!bytes.Contains(out, []byte("is not supported"))
b.flagCache[key] = supported b.flagCache[key] = supported
return supported return supported
} }