mirror of
https://github.com/containers/skopeo.git
synced 2025-08-15 13:13:42 +00:00
makefile: use -buildmode=pie
The security benefits of PIC binaries are quite well known (since they work with ASLR), and there is effectively no downside. In addition, we've been seeing some weird linker errors on ppc64le that are resolved by using -buildmode=pie. Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
parent
c928962ea8
commit
b23cac9c05
6
Makefile
6
Makefile
@ -29,6 +29,10 @@ ifeq ($(DEBUG), 1)
|
|||||||
override GOGCFLAGS += -N -l
|
override GOGCFLAGS += -N -l
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(shell go env GOOS), linux)
|
||||||
|
GO_DYN_FLAGS="-buildmode=pie"
|
||||||
|
endif
|
||||||
|
|
||||||
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
||||||
DOCKER_IMAGE := skopeo-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH))
|
DOCKER_IMAGE := skopeo-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH))
|
||||||
# set env like gobuildtag?
|
# set env like gobuildtag?
|
||||||
@ -71,7 +75,7 @@ binary-static: cmd/skopeo
|
|||||||
|
|
||||||
# Build w/o using Docker containers
|
# Build w/o using Docker containers
|
||||||
binary-local:
|
binary-local:
|
||||||
$(GPGME_ENV) $(GO) build -ldflags "-X main.gitCommit=${GIT_COMMIT}" -gcflags "$(GOGCFLAGS)" -tags "$(BUILDTAGS)" -o skopeo ./cmd/skopeo
|
$(GPGME_ENV) $(GO) build ${GO_DYN_FLAGS} -ldflags "-X main.gitCommit=${GIT_COMMIT}" -gcflags "$(GOGCFLAGS)" -tags "$(BUILDTAGS)" -o skopeo ./cmd/skopeo
|
||||||
|
|
||||||
binary-local-static:
|
binary-local-static:
|
||||||
$(GPGME_ENV) $(GO) build -ldflags "-extldflags \"-static\" -X main.gitCommit=${GIT_COMMIT}" -gcflags "$(GOGCFLAGS)" -tags "$(BUILDTAGS)" -o skopeo ./cmd/skopeo
|
$(GPGME_ENV) $(GO) build -ldflags "-extldflags \"-static\" -X main.gitCommit=${GIT_COMMIT}" -gcflags "$(GOGCFLAGS)" -tags "$(BUILDTAGS)" -o skopeo ./cmd/skopeo
|
||||||
|
Loading…
Reference in New Issue
Block a user