Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use -buildmode=pie for binaries #919

Merged
merged 1 commit into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,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)'
astrived marked this conversation as resolved.
Show resolved Hide resolved
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