From e5f549099b3a4af46171f7cc4fdaec9cc441acb9 Mon Sep 17 00:00:00 2001 From: Xiaodong Liu Date: Fri, 14 Aug 2020 17:52:48 +0800 Subject: [PATCH] -buildmode=pie is not supported for some arch Signed-off-by: Xiaodong Liu --- Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b95bacfc..0460b995 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,9 @@ BASHINSTALLDIR=${PREFIX}/share/bash-completion/completions GO ?= go GOBIN := $(shell $(GO) env GOBIN) +GOOS ?= $(shell go env GOOS) +GOARCH ?= $(shell go env GOARCH) + ifeq ($(GOBIN),) GOBIN := $(GOPATH)/bin endif @@ -43,8 +46,10 @@ ifeq ($(DEBUG), 1) override GOGCFLAGS += -N -l endif -ifeq ($(shell $(GO) env GOOS), linux) - GO_DYN_FLAGS="-buildmode=pie" +ifeq ($(GOOS), linux) + ifneq ($(GOARCH),$(filter $(GOARCH),mips mipsle mips64 mips64le ppc64 riscv64)) + GO_DYN_FLAGS="-buildmode=pie" + endif endif GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)