]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: update gcc version check for asan support on ppc64le
authorArchana R <aravind5@in.ibm.com>
Thu, 29 Sep 2022 14:53:18 +0000 (09:53 -0500)
committerLynn Boger <laboger@linux.vnet.ibm.com>
Tue, 4 Oct 2022 17:19:12 +0000 (17:19 +0000)
Update the minimum version required for asan to be gcc9.
This will ensure that go build -asan is supported only on
systems with the required version of gcc. Update the asan
error message to include the name of the compiler (the
error message is updated to include the name of the compiler
instead of C compiler for other platforms as well).

Related to CL 425355

Change-Id: Ib864d43b2b3028f39ffcf792890a678361f507f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/436740
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/go/internal/work/init.go
src/cmd/go/testdata/script/install_msan_and_race_and_asan_require_cgo.txt

index d5f7c9c4b3c713218d8f5d3c43ae63b7140b0e66..d30b9683e297f92a944e2dc4b53737ceb07441ef 100644 (file)
@@ -423,12 +423,15 @@ func compilerRequiredAsanVersion() error {
 
        switch compiler.name {
        case "gcc":
+               if runtime.GOARCH == "ppc64le" && compiler.major < 9 {
+                       return fmt.Errorf("-asan is not supported with %s compiler %d.%d\n", compiler.name, compiler.major, compiler.minor)
+               }
                if compiler.major < 7 {
-                       return fmt.Errorf("-asan is not supported with C compiler %d.%d\n", compiler.major, compiler.minor)
+                       return fmt.Errorf("-asan is not supported with %s compiler %d.%d\n", compiler.name, compiler.major, compiler.minor)
                }
        case "clang":
                if compiler.major < 9 {
-                       return fmt.Errorf("-asan is not supported with C compiler %d.%d\n", compiler.major, compiler.minor)
+                       return fmt.Errorf("-asan is not supported with %s compiler %d.%d\n", compiler.name, compiler.major, compiler.minor)
                }
        default:
                return fmt.Errorf("-asan: C compiler is not gcc or clang")
index d496eaa9cd9890a11eb390d48dbbd6219c0eb13d..0c68e2cf1bd8a5648f9db7304ec3e04d97ef6b2e 100644 (file)
@@ -11,10 +11,10 @@ env CGO_ENABLED=0
 [msan] ! stderr '-race'
 
 [asan] ! go install -asan triv.go
-[asan] stderr '(-asan: the version of $(go env CC) could not be parsed)|(-asan: C compiler is not gcc or clang)|(-asan is not supported with C compiler (\d+)\.(\d+))|(-asan requires cgo)'
+[asan] stderr '(-asan: the version of $(go env CC) could not be parsed)|(-asan: C compiler is not gcc or clang)|(-asan is not supported with [A-Za-z]+ compiler (\d+)\.(\d+))|(-asan requires cgo)'
 [asan] ! stderr '-msan'
 
 -- triv.go --
 package main
 
-func main() {}
\ No newline at end of file
+func main() {}