...

Source file src/cmd/internal/sys/supported.go

     1	// Copyright 2018 The Go Authors. All rights reserved.
     2	// Use of this source code is governed by a BSD-style
     3	// license that can be found in the LICENSE file.
     4	
     5	package sys
     6	
     7	// RaceDetectorSupported reports whether goos/goarch supports the race
     8	// detector. There is a copy of this function in cmd/dist/test.go.
     9	// Race detector only supports 48-bit VMA on arm64. But it will always
    10	// return true for arm64, because we don't have VMA size information during
    11	// the compile time.
    12	func RaceDetectorSupported(goos, goarch string) bool {
    13		switch goos {
    14		case "linux":
    15			return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64"
    16		case "darwin", "freebsd", "netbsd", "windows":
    17			return goarch == "amd64"
    18		default:
    19			return false
    20		}
    21	}
    22	
    23	// MSanSupported reports whether goos/goarch supports the memory
    24	// sanitizer option. There is a copy of this function in cmd/dist/test.go.
    25	func MSanSupported(goos, goarch string) bool {
    26		switch goos {
    27		case "linux":
    28			return goarch == "amd64" || goarch == "arm64"
    29		default:
    30			return false
    31		}
    32	}
    33	
    34	// MustLinkExternal reports whether goos/goarch requires external linking.
    35	func MustLinkExternal(goos, goarch string) bool {
    36		switch goos {
    37		case "android":
    38			return true
    39		case "darwin":
    40			if goarch == "arm" || goarch == "arm64" {
    41				return true
    42			}
    43		}
    44		return false
    45	}
    46	

View as plain text