Merge pull request #40973 from XiaodongLoong/master

-buildmode=pie is not supported for the mips arch
This commit is contained in:
Sebastiaan van Stijn 2020-05-26 08:30:49 +02:00 committed by GitHub
commit 2d762840f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 18 additions and 9 deletions

View File

@ -13,7 +13,7 @@ install_containerd() (
git checkout -q "$CONTAINERD_COMMIT"
export BUILDTAGS='netgo osusergo static_build'
export EXTRA_FLAGS='-buildmode=pie'
export EXTRA_FLAGS=${GO_BUILDMODE}
export EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"'
# Reset build flags to nothing if we want a dynbinary

View File

@ -26,5 +26,5 @@ build_dockercli() {
git checkout -q "v$DOCKERCLI_VERSION"
mkdir -p "$GOPATH/src/github.com/docker"
mv components/cli "$GOPATH/src/github.com/docker/cli"
go build -buildmode=pie -o "${PREFIX}/docker" "github.com/docker/cli/cmd/docker"
go build ${GO_BUILDMODE} -o "${PREFIX}/docker" "github.com/docker/cli/cmd/docker"
}

View File

@ -13,7 +13,7 @@ install_golangci_lint() {
commitDate="$(git show -s --format=%cd)"
go build \
-buildmode=pie \
${GO_BUILDMODE} \
-ldflags "-s -w -X \"main.version=${version}\" -X \"main.commit=${commit}\" -X \"main.date=${commitDate}\"" \
-o "${PREFIX}/golangci-lint" "github.com/golangci/golangci-lint/cmd/golangci-lint"
}

View File

@ -6,6 +6,6 @@ install_gotestsum() (
set -e
export GO111MODULE=on
go get -d "gotest.tools/gotestsum@${GOTESTSUM_COMMIT}"
go build -buildmode=pie -o "${PREFIX}/gotestsum" 'gotest.tools/gotestsum'
go build ${GO_BUILDMODE} -o "${PREFIX}/gotestsum" 'gotest.tools/gotestsum'
)

View File

@ -15,6 +15,15 @@ if [ -z "$TMP_GOPATH" ]; then
else
export GOPATH="$TMP_GOPATH"
fi
case "$(go env GOARCH)" in
mips* | ppc64)
# pie build mode is not supported on mips architectures
export GO_BUILDMODE=""
;;
*)
export GO_BUILDMODE="-buildmode=pie"
;;
esac
dir="$(dirname $0)"

View File

@ -23,7 +23,7 @@ install_proxy() {
install_proxy_dynamic() {
export PROXY_LDFLAGS="-linkmode=external" install_proxy
export BUILD_MODE="-buildmode=pie"
export BUILD_MODE=${GO_BUILDMODE}
_install_proxy
}

View File

@ -21,7 +21,7 @@ install_rootlesskit() {
install_rootlesskit_dynamic() {
export ROOTLESSKIT_LDFLAGS="-linkmode=external" install_rootlesskit
export BUILD_MODE="-buildmode=pie"
export BUILD_MODE=${GO_BUILDMODE}
_install_rootlesskit
}

View File

@ -7,5 +7,5 @@ install_shfmt() {
git clone https://github.com/mvdan/sh.git "$GOPATH/src/github.com/mvdan/sh"
cd "$GOPATH/src/github.com/mvdan/sh" || exit 1
git checkout -q "$SHFMT_COMMIT"
GO111MODULE=on go build -buildmode=pie -v -o "${PREFIX}/shfmt" ./cmd/shfmt
GO111MODULE=on go build ${GO_BUILDMODE} -v -o "${PREFIX}/shfmt" ./cmd/shfmt
}

View File

@ -8,5 +8,5 @@ install_tomlv() {
echo "Install tomlv version $TOMLV_COMMIT"
git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml"
cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT"
go build -v -buildmode=pie -o "${PREFIX}/tomlv" "github.com/BurntSushi/toml/cmd/tomlv"
go build -v ${GO_BUILDMODE} -o "${PREFIX}/tomlv" "github.com/BurntSushi/toml/cmd/tomlv"
}

View File

@ -7,5 +7,5 @@ install_vndr() {
git clone https://github.com/LK4D4/vndr.git "$GOPATH/src/github.com/LK4D4/vndr"
cd "$GOPATH/src/github.com/LK4D4/vndr" || exit 1
git checkout -q "$VNDR_COMMIT"
go build -buildmode=pie -v -o "${PREFIX}/vndr" .
go build ${GO_BUILDMODE} -v -o "${PREFIX}/vndr" .
}