2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 01:51:51 +00:00

make: Be able to force turning off piegen

For testing purpose we need to disable using of
piegen utility. So lets add PIEGEN make option
thus one can "PIEGEN=no make" to build criu
without piegen at all.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov 2015-06-16 12:31:00 +03:00 committed by Pavel Emelyanov
parent 2a0c8db72b
commit bf4243e303
4 changed files with 21 additions and 8 deletions

View File

@ -118,6 +118,16 @@ export ARCH SRCARCH
$(if $(wildcard $(ARCH_DIR)),,$(error "The architecture $(ARCH) isn't supported"))
#
# piegen might be disabled by hands. Don't use it until
# you know what you're doing.
ifneq ($(filter i386 ia32 x86_64 ppc64le, $(ARCH)),)
ifneq ($(PIEGEN),no)
piegen-y := y
export piegen-y
endif
endif
cflags-y += -iquote include -iquote pie -iquote .
cflags-y += -iquote $(ARCH_DIR) -iquote $(ARCH_DIR)/include
cflags-y += -fno-strict-aliasing
@ -152,8 +162,8 @@ ARCH-LIB := $(ARCH_DIR)/crtools.built-in.o
CRIU-SO := libcriu
CRIU-LIB := lib/$(CRIU-SO).so
CRIU-INC := lib/criu.h include/criu-plugin.h include/criu-log.h protobuf/rpc.proto
ifneq ($(filter i386 ia32 x86_64 ppc64le, $(ARCH)),)
PIEGEN := pie/piegen/piegen
ifeq ($(piegen-y),y)
piegen := pie/piegen/piegen
endif
export CC MAKE CFLAGS LIBS SRCARCH DEFINES MAKEFLAGS CRIU-SO
@ -197,20 +207,20 @@ $(ARCH_DIR)/%:: protobuf config
$(ARCH_DIR): protobuf config
$(Q) $(MAKE) $(build)=$(ARCH_DIR) all
ifneq ($(filter i386 ia32 x86_64 ppc64le, $(ARCH)),)
ifeq ($(piegen-y),y)
pie/piegen/%: config
$(Q) $(MAKE) $(build)=pie/piegen $@
pie/piegen: config
$(Q) $(MAKE) $(build)=pie/piegen all
$(PIEGEN): pie/piegen/built-in.o
$(piegen): pie/piegen/built-in.o
$(E) " LINK " $@
$(Q) $(CC) $(CFLAGS) pie/piegen/built-in.o $(LDFLAGS) -o $@
.PHONY: pie/piegen
endif
pie/%:: $(ARCH_DIR) $(PIEGEN)
pie/%:: $(ARCH_DIR) $(piegen)
$(Q) $(MAKE) $(build)=pie $@
pie: $(ARCH_DIR) $(PIEGEN)
pie: $(ARCH_DIR) $(piegen)
$(Q) $(MAKE) $(build)=pie all
%.o %.i %.s %.d: $(VERSION_HEADER) pie

View File

@ -40,6 +40,9 @@ ifeq ($(VDSO),y)
endif
ifeq ($(call try-cc,$(SETPROCTITLE_INIT_TEST),-lbsd),y)
$(Q) @echo '#define CONFIG_HAS_SETPROCTITLE_INIT' >> $@
endif
ifeq ($(piegen-y),y)
$(Q) @echo '#define CONFIG_PIEGEN' >> $@
endif
$(Q) @echo '#endif /* __CR_CONFIG_H__ */' >> $@

View File

@ -52,7 +52,7 @@ PIELDS := pie.lds.S
.SECONDARY:
ifneq ($(filter i386 ia32 x86_64 ppc64le, $(ARCH)),)
ifeq ($(piegen-y),y)
ldflags-y += -r
target-name = $(patsubst pie/%-blob.h,%,$(1))

View File

@ -6,7 +6,7 @@
#include "compiler.h"
#include "config.h"
#if defined(CONFIG_X86_64) || defined(CONFIG_X86_32) || defined(CONFIG_PPC64)
#ifdef CONFIG_PIEGEN
extern __maybe_unused void elf_relocs_apply(void *mem, void *vbase, size_t size,
elf_reloc_t *elf_relocs, size_t nr_relocs);