From a3e31595a49b6e4e826d61d6dee89d3f2d898650 Mon Sep 17 00:00:00 2001 From: Dmitry Safonov Date: Fri, 9 Dec 2016 21:19:32 +0300 Subject: [PATCH] criu/pie: drop second compat parasite Let's try having one with two entries/exits. travis-ci: success for Rectify 32-bit compatible C/R on x86 Signed-off-by: Dmitry Safonov Signed-off-by: Pavel Emelyanov Signed-off-by: Andrei Vagin --- .gitignore | 2 +- criu/parasite-syscall.c | 7 +-- criu/pie/Makefile | 115 ++++++++++----------------------------- criu/pie/parasite-blob.h | 5 -- 4 files changed, 31 insertions(+), 98 deletions(-) delete mode 100644 criu/pie/parasite-blob.h diff --git a/.gitignore b/.gitignore index 48ea4fb13..c3f82939d 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,7 @@ criu/include/syscall*.h soccr/config.h criu/include/version.h criu/pie/restorer-blob.h -criu/pie/parasite-*-blob.h +criu/pie/parasite-blob.h criu/pie/pie.lds*.S criu/protobuf-desc-gen.h lib/build/ diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c index c93881b58..690713066 100644 --- a/criu/parasite-syscall.c +++ b/criu/parasite-syscall.c @@ -578,12 +578,7 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item, ictx->log_fd = log_get_fd(); - if (compel_mode_native(ctl)) - parasite_native_setup_c_header(ctl); -#ifdef CONFIG_COMPAT - else - parasite_compat_setup_c_header(ctl); -#endif + parasite_setup_c_header(ctl); parasite_ensure_args_size(dump_pages_args_size(vma_area_list)); parasite_ensure_args_size(aio_rings_args_size(vma_area_list)); diff --git a/criu/pie/Makefile b/criu/pie/Makefile index de6cf6436..e05bb0bbc 100644 --- a/criu/pie/Makefile +++ b/criu/pie/Makefile @@ -1,123 +1,66 @@ -# native/compat target names are _only_ for parasite -# restorer is always native (64-bit) -parasite_target := native +target += parasite restorer -ifeq ($(CONFIG_COMPAT),y) - parasite_target += compat -endif +compel_lds := $(SRC_DIR)/compel/arch/$(ARCH)/scripts/compel-pack.lds.S +compel_std := $(SRC_DIR)/compel/plugins/std.built-in.o +parasite-obj-e += ./compel/plugins/std.built-in.o +restorer-obj-e += ./compel/plugins/std.built-in.o -compel_pack_lds-native := $(SRC_DIR)/compel/arch/$(ARCH)/scripts/compel-pack.lds.S -compel_pack_lds-compat := $(SRC_DIR)/compel/arch/$(ARCH)/scripts/compel-pack-compat.lds.S -compel_std-native := $(SRC_DIR)/compel/plugins/std.built-in.o -compel_std-compat := $(SRC_DIR)/compel/plugins/std-compat.built-in.o - -native-obj-y += parasite.o -compat-obj-y += compat/parasite-compat.o - -restorer-obj-y += restorer.o -restorer-obj-y += ./$(ARCH_DIR)/restorer.o +parasite-obj-y += parasite.o +restorer-obj-y += restorer.o +restorer-obj-y += ./$(ARCH_DIR)/restorer.o ifeq ($(ARCH),x86) - restorer-obj-e += ./compel/plugins/std.built-in.o - ifeq ($(CONFIG_COMPAT),y) restorer-obj-y += ./$(ARCH_DIR)/call32.o restorer-obj-y += ./$(ARCH_DIR)/sigaction_compat_pie.o endif - - native-obj-e += ./compel/plugins/std.built-in.o - compat-obj-e += ./compel/plugins/std-compat.built-in.o -else - native-obj-e += ./compel/plugins/std.built-in.o - restorer-obj-e += ./compel/plugins/std.built-in.o endif -target += $(parasite_target) restorer - # # We can't provide proper mount implementation # in parasite code -- it requires run-time rellocation # applications, which is not the target of the # project. # -CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) -CFLAGS := $(filter-out -DCONFIG_X86_64,$(CFLAGS)) -CFLAGS += -iquote $(SRC_DIR)/criu/arch/$(ARCH)/include -CFLAGS += -iquote $(SRC_DIR)/criu/include -CFLAGS += -iquote $(SRC_DIR)/include -CFLAGS += -iquote $(SRC_DIR) -CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -CFLAGS += -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0 +CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) +CFLAGS += -iquote $(SRC_DIR)/criu/arch/$(ARCH)/include +CFLAGS += -iquote $(SRC_DIR)/criu/include +CFLAGS += -iquote $(SRC_DIR)/include +CFLAGS += -iquote $(SRC_DIR) +CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 +CFLAGS += -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0 + +ccflags-y += -I compel/include/uapi +ccflags-y += -I compel/plugins/include/uapi +ccflags-y += -DCR_NOGLIBC +ccflags-y += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 +ccflags-y += -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0 -ccflags-y += -I compel/include/uapi -ccflags-y += -I compel/plugins/include/uapi -ccflags-y += -DCR_NOGLIBC -ccflags-y += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 ifneq ($(filter-out clean mrproper,$(MAKECMDGOALS)),) -NATIVE_CFLAGS := $(shell $(SRC_DIR)/compel/compel-host --arch=$(ARCH) cflags) -ifeq ($(ARCH),x86) - COMPAT_CFLAGS := $(shell $(SRC_DIR)/compel/compel-host --arch=ia32 cflags) + CFLAGS += $(shell $(SRC_DIR)/compel/compel-host --arch=$(ARCH) cflags) endif -endif - -ifeq ($(ARCH),x86) - NATIVE_CFLAGS += -DCONFIG_X86_64 - COMPAT_CFLAGS += -m32 -DCONFIG_X86_32 - COMPAT_LDFLAGS += -m elf_i386 -endif - -CFLAGS_restorer.o += $(NATIVE_CFLAGS) -# $1 - object name -define obj-export-native-flags - CFLAGS_$(notdir $(1)) := $(NATIVE_CFLAGS) -endef -# $1 - object name -define obj-export-compat-flags - CFLAGS_$(notdir $(1)) := $(COMPAT_CFLAGS) - LDFLAGS_$(notdir $(1)) := $(COMPAT_LDFLAGS) -endef - -$(eval $(call map,obj-export-native-flags,$(restorer-obj-y))) -$(eval $(call map,obj-export-native-flags,$(native-obj-y) native)) -$(eval $(call map,obj-export-compat-flags,$(compat-obj-y) compat)) ifeq ($(SRCARCH),arm) ccflags-y += -marm endif -asflags-y += -D__ASSEMBLY__ +asflags-y += -D__ASSEMBLY__ -BLOBS += $(obj)/restorer-blob.h - -define gen-pields-blobs-var -BLOBS += $(obj)/parasite-$(1)-blob.h -endef -$(eval $(call map,gen-pields-blobs-var,$(parasite_target))) +BLOBS += $(obj)/restorer-blob.h $(obj)/parasite-blob.h .SECONDARY: -# for C files, we need "parasite-native" to be "parasite_native" -target-name = $(patsubst criu/pie/%_blob.h,%,$(subst -,_,$(1))) +target-name = $(patsubst criu/pie/%-blob.h,%,$(1)) ifeq ($(strip $(V)),) piegen_stdout := >/dev/null endif -$(obj)/restorer.built-in.o: $(compel_std-native) -$(obj)/restorer.built-in.bin.o: $(obj)/restorer.built-in.o \ - $(obj)/pie.lib.a $(compel_pack_lds-native) +$(obj)/restorer.built-in.o: $(compel_std) +$(obj)/parasite.built-in.o: $(compel_std) +$(obj)/%.built-in.bin.o: $(obj)/%.built-in.o $(obj)/pie.lib.a $(compel_lds) $(call msg-gen, $@) - $(Q) $(LD) -r -T $(compel_pack_lds-native) -o $@ $< $(obj)/pie.lib.a - -# $1 - binary mode: native/compat -define gen-rule-built-in.bin.o -$(obj)/$(1).built-in.o: $(compel_std-$(1)) -$(obj)/parasite-$(1).built-in.bin.o: $(obj)/$(1).built-in.o \ - $(obj)/pie.lib.a $(compel_pack_lds-$(1)) - $$(call msg-gen, $$@) - $(Q) $(LD) -r -T $(compel_pack_lds-$(1)) -o $$@ $$< $(obj)/pie.lib.a -endef -$(eval $(call map,gen-rule-built-in.bin.o,$(parasite_target))) + $(Q) $(LD) -r -T $(compel_lds) -o $@ $< $(obj)/pie.lib.a $(obj)/%-blob.h: $(obj)/%.built-in.bin.o $(SRC_DIR)/compel/compel-host $(call msg-gen, $@) diff --git a/criu/pie/parasite-blob.h b/criu/pie/parasite-blob.h deleted file mode 100644 index ddafd05f5..000000000 --- a/criu/pie/parasite-blob.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "parasite-native-blob.h" - -#ifdef CONFIG_COMPAT -# include "parasite-compat-blob.h" -#endif