Skip to content

Commit

Permalink
Use -buildmode=pie for binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
Claes Mogren committed Apr 20, 2020
1 parent 9c86334 commit b8759cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ jobs:
<<: *env
# Target the GOARCH for x86_64
ARCH: amd64
BUILD_MODE: "-buildmode=pie"

build_aarch64:
<<: *build
environment:
<<: *env
# Target the GOARCH for aarch64
ARCH: arm64
BUILD_MODE: ""

integration_test:
docker:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ DOCKER_ARCH = $(lastword $(subst :, ,$(filter $(ARCH):%,amd64:amd64 arm64:arm64v
IMAGE_ARCH_SUFFIX = $(addprefix -,$(filter $(ARCH),arm64))
# GOLANG_IMAGE is the building golang container image used.
GOLANG_IMAGE = golang:1.13-stretch
# For the requseted build, these are the set of Go specific build environment
# variables.
# For the requested build, these are the set of Go specific build environment variables.
export GOARCH ?= $(ARCH)
export GOOS = linux
export CGO_ENABLED = 0
Expand Down Expand Up @@ -94,7 +93,8 @@ dist: all
docker save $(METRICS_IMAGE_NAME) | gzip > $(METRICS_IMAGE_DIST)

# Build the VPC CNI plugin agent using the host's Go toolchain.
build-linux: BUILD_FLAGS = -ldflags '-s -w $(LDFLAGS)'
BUILD_MODE ?= -buildmode=pie
build-linux: BUILD_FLAGS = $(BUILD_MODE) -ldflags '-s -w $(LDFLAGS)'
build-linux:
go build $(BUILD_FLAGS) -o aws-k8s-agent ./cmd/aws-k8s-agent
go build $(BUILD_FLAGS) -o aws-cni ./cmd/routed-eni-cni-plugin
Expand Down

0 comments on commit b8759cf

Please sign in to comment.