X Tutup
Skip to content

Commit b8c4d85

Browse files
committed
Add buildmode=pie to makefile
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
1 parent 8c77d9a commit b8c4d85

File tree

6 files changed

+10
-6
lines changed

6 files changed

+10
-6
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ script:
4949
- export CGO_ENABLED=$TRAVIS_CGO_ENABLED
5050
- GIT_CHECK_EXCLUDE="./vendor" TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE/.../..}" make dco
5151
- make fmt
52-
# FIXME: For non-linux GOOS, without running `go build -i`, vet fails with `vet: import failed: can't find import: fmt`...
53-
# Note that `go build -i` requires write permission to GOROOT. (So it is not called in Makefile)
5452
- go build -i .
5553
- make setup
5654
- make lint

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ GO_TAGS=$(if $(BUILDTAGS),-tags "$(BUILDTAGS)",)
4545
GO_LDFLAGS=-ldflags "-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PKG) $(EXTRA_LDFLAGS)"
4646

4747
TESTFLAGS_RACE=
48+
GO_GCFLAGS=
4849

4950
#Detect the target os
5051
include Makefile.OS

Makefile.darwin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
COMMANDS += containerd-shim
33

44
# amd64 supports go test -race
5-
ifeq ("amd64", $(GOARCH))
5+
ifeq ($(GOARCH),amd64)
66
TESTFLAGS_RACE= -race
77
endif

Makefile.freebsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
COMMANDS += containerd-shim
33

44
# amd64 supports go test -race
5-
ifeq ("amd64", $(GOARCH))
5+
ifeq ($(GOARCH),amd64)
66
TESTFLAGS_RACE= -race
77
endif

Makefile.linux

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#linux specific settings
22
COMMANDS += containerd-shim
33

4+
# check GOOS for cross compile builds
5+
ifeq ($(GOOS),linux)
6+
GO_GCFLAGS= -buildmode=pie
7+
endif
8+
49
# amd64 supports go test -race
5-
ifeq ("amd64", $(GOARCH))
10+
ifeq ($(GOARCH),amd64)
611
TESTFLAGS_RACE= -race
712
endif

Makefile.windows

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ FIX_PATH = $(subst /,\,$1)
66
BINARY_SUFFIX=".exe"
77

88
# amd64 supports go test -race
9-
ifeq ("amd64", $(GOARCH))
9+
ifeq ($(GOARCH),amd64)
1010
TESTFLAGS_RACE= -race
1111
endif

0 commit comments

Comments
 (0)
X Tutup