ldmode=pie is not supported for the mips arch

reference:
https://github.com/docker/cli/pull/2507
4c99c81326

Signed-off-by: Xiaodong Liu <liuxiaodong@loongson.cn>
This commit is contained in:
Xiaodong Liu 2020-05-21 09:23:00 +08:00
parent e573542078
commit 0c350e87a0
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" .
}