1
0
mirror of https://github.com/golang/go synced 2024-11-22 21:50:03 -07:00

cmd/link: recognize clang linker error in testCGOLTO

Also recognize a case in which GCC does not run (from
https://build.golang.org/log/7f6d8b35c905b9829f05906beccca44f208aa569).

Fixes #46517

Change-Id: I4fe4164a5df92b2dec08fd767f65a4d5479f3f36
Reviewed-on: https://go-review.googlesource.com/c/go/+/324169
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
Ian Lance Taylor 2021-06-02 07:43:57 -07:00
parent 1c6a2ea2ea
commit ff9f5fb859

View File

@ -121,11 +121,14 @@ func testCGOLTO(t *testing.T, cc string, test int) {
t.Logf("go build failed: %v", err)
// Error messages we've seen indicating that LTO is not supported.
// These errors come from GCC or clang, not Go.
var noLTO = []string{
`unrecognized command line option "-flto"`,
"unable to pass LLVM bit-code files to linker",
"file not recognized: File format not recognized",
"LTO support has not been enabled",
"linker command failed with exit code",
"gcc: can't load library",
}
for _, msg := range noLTO {
if bytes.Contains(out, []byte(msg)) {