Merge pull request #44748 from vvoland/buildflags-nopie-whenrace

hack/make: Don't add -buildmode=pie with -race
This commit is contained in:
Sebastiaan van Stijn 2023-01-05 20:24:21 +01:00 committed by GitHub
commit 57af88a654
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,12 +74,15 @@ source "${MAKEDIR}/.go-autogen"
# -buildmode=pie is not supported on Windows arm64 and Linux mips*, ppc64be
# https://github.com/golang/go/blob/go1.19.4/src/cmd/internal/sys/supported.go#L125-L132
if ! [ "$DOCKER_STATIC" = "1" ]; then
case "$(go env GOOS)/$(go env GOARCH)" in
windows/arm64 | linux/mips* | linux/ppc64) ;;
*)
BUILDFLAGS+=("-buildmode=pie")
;;
esac
# -buildmode=pie not supported when -race is enabled
if [[ " $BUILDFLAGS " != *" -race "* ]]; then
case "$(go env GOOS)/$(go env GOARCH)" in
windows/arm64 | linux/mips* | linux/ppc64) ;;
*)
BUILDFLAGS+=("-buildmode=pie")
;;
esac
fi
fi
# only necessary for non-sandboxed invocation where TARGETPLATFORM is empty