Commit bf4243e3 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

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: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 2a0c8db7
...@@ -118,6 +118,16 @@ export ARCH SRCARCH ...@@ -118,6 +118,16 @@ export ARCH SRCARCH
$(if $(wildcard $(ARCH_DIR)),,$(error "The architecture $(ARCH) isn't supported")) $(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 include -iquote pie -iquote .
cflags-y += -iquote $(ARCH_DIR) -iquote $(ARCH_DIR)/include cflags-y += -iquote $(ARCH_DIR) -iquote $(ARCH_DIR)/include
cflags-y += -fno-strict-aliasing cflags-y += -fno-strict-aliasing
...@@ -152,8 +162,8 @@ ARCH-LIB := $(ARCH_DIR)/crtools.built-in.o ...@@ -152,8 +162,8 @@ ARCH-LIB := $(ARCH_DIR)/crtools.built-in.o
CRIU-SO := libcriu CRIU-SO := libcriu
CRIU-LIB := lib/$(CRIU-SO).so CRIU-LIB := lib/$(CRIU-SO).so
CRIU-INC := lib/criu.h include/criu-plugin.h include/criu-log.h protobuf/rpc.proto CRIU-INC := lib/criu.h include/criu-plugin.h include/criu-log.h protobuf/rpc.proto
ifneq ($(filter i386 ia32 x86_64 ppc64le, $(ARCH)),) ifeq ($(piegen-y),y)
PIEGEN := pie/piegen/piegen piegen := pie/piegen/piegen
endif endif
export CC MAKE CFLAGS LIBS SRCARCH DEFINES MAKEFLAGS CRIU-SO export CC MAKE CFLAGS LIBS SRCARCH DEFINES MAKEFLAGS CRIU-SO
...@@ -197,20 +207,20 @@ $(ARCH_DIR)/%:: protobuf config ...@@ -197,20 +207,20 @@ $(ARCH_DIR)/%:: protobuf config
$(ARCH_DIR): protobuf config $(ARCH_DIR): protobuf config
$(Q) $(MAKE) $(build)=$(ARCH_DIR) all $(Q) $(MAKE) $(build)=$(ARCH_DIR) all
ifneq ($(filter i386 ia32 x86_64 ppc64le, $(ARCH)),) ifeq ($(piegen-y),y)
pie/piegen/%: config pie/piegen/%: config
$(Q) $(MAKE) $(build)=pie/piegen $@ $(Q) $(MAKE) $(build)=pie/piegen $@
pie/piegen: config pie/piegen: config
$(Q) $(MAKE) $(build)=pie/piegen all $(Q) $(MAKE) $(build)=pie/piegen all
$(PIEGEN): pie/piegen/built-in.o $(piegen): pie/piegen/built-in.o
$(E) " LINK " $@ $(E) " LINK " $@
$(Q) $(CC) $(CFLAGS) pie/piegen/built-in.o $(LDFLAGS) -o $@ $(Q) $(CC) $(CFLAGS) pie/piegen/built-in.o $(LDFLAGS) -o $@
.PHONY: pie/piegen .PHONY: pie/piegen
endif endif
pie/%:: $(ARCH_DIR) $(PIEGEN) pie/%:: $(ARCH_DIR) $(piegen)
$(Q) $(MAKE) $(build)=pie $@ $(Q) $(MAKE) $(build)=pie $@
pie: $(ARCH_DIR) $(PIEGEN) pie: $(ARCH_DIR) $(piegen)
$(Q) $(MAKE) $(build)=pie all $(Q) $(MAKE) $(build)=pie all
%.o %.i %.s %.d: $(VERSION_HEADER) pie %.o %.i %.s %.d: $(VERSION_HEADER) pie
......
...@@ -40,6 +40,9 @@ ifeq ($(VDSO),y) ...@@ -40,6 +40,9 @@ ifeq ($(VDSO),y)
endif endif
ifeq ($(call try-cc,$(SETPROCTITLE_INIT_TEST),-lbsd),y) ifeq ($(call try-cc,$(SETPROCTITLE_INIT_TEST),-lbsd),y)
$(Q) @echo '#define CONFIG_HAS_SETPROCTITLE_INIT' >> $@ $(Q) @echo '#define CONFIG_HAS_SETPROCTITLE_INIT' >> $@
endif
ifeq ($(piegen-y),y)
$(Q) @echo '#define CONFIG_PIEGEN' >> $@
endif endif
$(Q) @echo '#endif /* __CR_CONFIG_H__ */' >> $@ $(Q) @echo '#endif /* __CR_CONFIG_H__ */' >> $@
......
...@@ -52,7 +52,7 @@ PIELDS := pie.lds.S ...@@ -52,7 +52,7 @@ PIELDS := pie.lds.S
.SECONDARY: .SECONDARY:
ifneq ($(filter i386 ia32 x86_64 ppc64le, $(ARCH)),) ifeq ($(piegen-y),y)
ldflags-y += -r ldflags-y += -r
target-name = $(patsubst pie/%-blob.h,%,$(1)) target-name = $(patsubst pie/%-blob.h,%,$(1))
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "compiler.h" #include "compiler.h"
#include "config.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, extern __maybe_unused void elf_relocs_apply(void *mem, void *vbase, size_t size,
elf_reloc_t *elf_relocs, size_t nr_relocs); elf_reloc_t *elf_relocs, size_t nr_relocs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment