[CRIU] [PATCHv3 06/23] criu/pie: drop second compat parasite

Dmitry Safonov dsafonov at virtuozzo.com
Fri Dec 9 10:19:32 PST 2016


Let's try having one with two entries/exits.

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 .gitignore               |   2 +-
 criu/parasite-syscall.c  |   7 +--
 criu/pie/Makefile        | 110 +++++++++++------------------------------------
 criu/pie/parasite-blob.h |   5 ---
 4 files changed, 28 insertions(+), 96 deletions(-)
 delete mode 100644 criu/pie/parasite-blob.h

diff --git a/.gitignore b/.gitignore
index 9193c6f140f0..1879db4632da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,7 +34,7 @@ criu/include/syscall-codes*.h
 criu/include/syscall*.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 6ebb21cd0080..9ccf3a773fbc 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 7d691d080668..2e9b1d33f432 100644
--- a/criu/pie/Makefile
+++ b/criu/pie/Makefile
@@ -1,121 +1,63 @@
-# 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_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
+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
 
-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		:= $(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)
 
-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)
-endif
-endif
+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
 
-ifeq ($(ARCH),x86)
-        NATIVE_CFLAGS	+= -DCONFIG_X86_64
-        COMPAT_CFLAGS	+= -m32 -DCONFIG_X86_32
-        COMPAT_LDFLAGS	+= -m elf_i386
+ifneq ($(filter-out clean mrproper,$(MAKECMDGOALS)),)
+        CFLAGS	+= $(shell $(SRC_DIR)/compel/compel-host --arch=$(ARCH) cflags)
 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 ddafd05f50ed..000000000000
--- 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
-- 
2.10.2



More information about the CRIU mailing list