Commit 3a7e027b authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Andrei Vagin

criu: pie -- Switch to use compel shipped lds scripts

Now when *.lds is in compel we can switch to it. Also -- remove
the criu lds generation code.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 0be8beb6
...@@ -6,6 +6,9 @@ ifeq ($(CONFIG_COMPAT),y) ...@@ -6,6 +6,9 @@ ifeq ($(CONFIG_COMPAT),y)
parasite_target += compat parasite_target += compat
endif 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
native-obj-y += parasite.o native-obj-y += parasite.o
native-obj-y += infect.o native-obj-y += infect.o
compat-obj-y += compat/parasite-compat.o compat-obj-y += compat/parasite-compat.o
...@@ -97,46 +100,12 @@ GEN-OFFSETS := $(obj)/../../scripts/gen-offsets.sh ...@@ -97,46 +100,12 @@ GEN-OFFSETS := $(obj)/../../scripts/gen-offsets.sh
BLOBS += $(obj)/restorer-blob.h BLOBS += $(obj)/restorer-blob.h
define gen-pields-blobs-var define gen-pields-blobs-var
PIELDS += $(obj)/pie.lds-$(1).S
BLOBS += $(obj)/parasite-$(1)-blob.h BLOBS += $(obj)/parasite-$(1)-blob.h
endef endef
$(eval $(call map,gen-pields-blobs-var,$(parasite_target))) $(eval $(call map,gen-pields-blobs-var,$(parasite_target)))
.SECONDARY: .SECONDARY:
ifeq ($(piegen-y),y)
PIELDS_INCLUDE := $(obj)/pie-reloc.lds.S.in
else
PIELDS_INCLUDE := $(obj)/pie.lds.S.in
endif
ifeq ($(ARCH),x86)
$(obj)/pie.lds-native.S: $(PIELDS_INCLUDE)
$(call msg-gen, $@)
$(Q) echo "OUTPUT_ARCH(i386:x86-64)" > $@
$(Q) echo "TARGET(elf64-x86-64)" >> $@
$(Q) cat $< >> $@
$(obj)/pie.lds-compat.S: $(PIELDS_INCLUDE)
$(call msg-gen, $@)
$(Q) echo "OUTPUT_ARCH(i386)" > $@
$(Q) echo "TARGET(elf32-i386)" >> $@
$(Q) cat $< >> $@
else # !x86
ifeq ($(filter-out i386 ia32,$(ARCH)),)
$(PIELDS): $(PIELDS_INCLUDE)
$(call msg-gen, $@)
$(Q) echo "OUTPUT_ARCH(i386)" > $@
$(Q) echo "TARGET(elf32-i386)" >> $@
$(Q) cat $< >> $@
else # arm, aarch64, ppc64
$(PIELDS): $(PIELDS_INCLUDE)
$(call msg-gen, $@)
$(Q) echo "OUTPUT_ARCH($(LDARCH))" > $@
$(Q) cat $< >> $@
endif # non i386
endif # non x86 ARCH
# for C files, we need "parasite-native" to be "parasite_native" # 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,%,$(subst -,_,$(1)))
...@@ -146,16 +115,16 @@ ifeq ($(strip $(V)),) ...@@ -146,16 +115,16 @@ ifeq ($(strip $(V)),)
endif endif
$(obj)/restorer.built-in.bin.o: $(obj)/restorer.built-in.o \ $(obj)/restorer.built-in.bin.o: $(obj)/restorer.built-in.o \
$(obj)/native.lib.a $(obj)/pie.lds-native.S $(obj)/native.lib.a $(compel_pack_lds-native)
$(call msg-gen, $@) $(call msg-gen, $@)
$(Q) $(LD) -r -T $(obj)/pie.lds-native.S -o $@ $< $(obj)/native.lib.a $(Q) $(LD) -r -T $(compel_pack_lds-native) -o $@ $< $(obj)/native.lib.a
# $1 - binary mode: native/compat # $1 - binary mode: native/compat
define gen-rule-built-in.bin.o define gen-rule-built-in.bin.o
$(obj)/parasite-$(1).built-in.bin.o: $(obj)/$(1).built-in.o \ $(obj)/parasite-$(1).built-in.bin.o: $(obj)/$(1).built-in.o \
$(obj)/$(1).lib.a $(obj)/pie.lds-$(1).S $(obj)/$(1).lib.a $(compel_pack_lds-$(1))
$$(call msg-gen, $$@) $$(call msg-gen, $$@)
$(Q) $(LD) -r -T $(obj)/pie.lds-$(1).S -o $$@ $$< $(obj)/$(1).lib.a $(Q) $(LD) -r -T $(compel_pack_lds-$(1)) -o $$@ $$< $(obj)/$(1).lib.a
endef endef
$(eval $(call map,gen-rule-built-in.bin.o,$(parasite_target))) $(eval $(call map,gen-rule-built-in.bin.o,$(parasite_target)))
...@@ -179,17 +148,17 @@ endif ...@@ -179,17 +148,17 @@ endif
define gen-rule-built-in.bin.o define gen-rule-built-in.bin.o
$(obj)/parasite-$(1).built-in.bin.o: $(obj)/$(1).built-in.o \ $(obj)/parasite-$(1).built-in.bin.o: $(obj)/$(1).built-in.o \
$(obj)/pie.lds-$(1).S $(obj)/native.lib.a $(compel_pack_lds-$(1)) $(obj)/native.lib.a
$$(call msg-gen, $$@) $$(call msg-gen, $$@)
$(Q) $(LD) $(LD_R) -T $(obj)/pie.lds-$(1).S -o $$@ $$< $(obj)/native.lib.a $(Q) $(LD) $(LD_R) -T $(compel_pack_lds-$(1)) -o $$@ $$< $(obj)/native.lib.a
endef endef
$(eval $(call map,gen-rule-built-in.bin.o,$(parasite_target))) $(eval $(call map,gen-rule-built-in.bin.o,$(parasite_target)))
$(obj)/restorer.built-in.bin.o: $(obj)/restorer.built-in.o \ $(obj)/restorer.built-in.bin.o: $(obj)/restorer.built-in.o \
$(obj)/pie.lds-native.S $(obj)/native.lib.a $(compel_pack_lds-native) $(obj)/native.lib.a
$(call msg-gen, $@) $(call msg-gen, $@)
$(Q) $(LD) $(LD_R) -T $(obj)/pie.lds-native.S -o $@ $< $(obj)/native.lib.a $(Q) $(LD) $(LD_R) -T $(compel_pack_lds-native) -o $@ $< $(obj)/native.lib.a
$(obj)/%.built-in.bin: $(obj)/%.built-in.bin.o $(obj)/%.built-in.bin: $(obj)/%.built-in.bin.o
$(call msg-gen, $@) $(call msg-gen, $@)
...@@ -206,7 +175,6 @@ all-y += $(BLOBS) ...@@ -206,7 +175,6 @@ all-y += $(BLOBS)
# blobs and pields are in cleanup, rather than in mrproper because # blobs and pields are in cleanup, rather than in mrproper because
# we want them to be re-generated after `make clean && make` # we want them to be re-generated after `make clean && make`
cleanup-y += $(BLOBS) cleanup-y += $(BLOBS)
cleanup-y += $(PIELDS)
cleanup-y += $(obj)/*.bin cleanup-y += $(obj)/*.bin
cleanup-y += $(obj)/*.built-in.bin.o cleanup-y += $(obj)/*.built-in.bin.o
cleanup-y += $(obj)/*.built-in.bin cleanup-y += $(obj)/*.built-in.bin
SECTIONS
{
.text : {
*(.head.text)
*(.text*)
*(.compel.init)
*(.compel.exit)
}
.data : {
*(.data*)
*(.bss*)
}
.rodata : {
*(.rodata*)
*(.got*)
}
.toc : ALIGN(8) {
*(.toc*)
}
/DISCARD/ : {
*(.debug*)
*(.comment*)
*(.note*)
*(.group*)
*(.eh_frame*)
}
/* Parasite args should have 4 bytes align, as we have futex inside. */
. = ALIGN(4);
__export_parasite_args = .;
}
SECTIONS
{
.crblob 0x0 : {
*(.head.text)
*(.text*)
. = ALIGN(32);
*(.data*)
. = ALIGN(32);
*(.rodata*)
. = ALIGN(32);
*(.bss*)
. = ALIGN(32);
*(.got*)
. = ALIGN(32);
*(.toc*)
. = ALIGN(32);
} =0x00000000,
/DISCARD/ : {
*(.debug*)
*(.comment*)
*(.note*)
*(.group*)
*(.eh_frame*)
*(*)
}
/* Parasite args should have 4 bytes align, as we have futex inside. */
. = ALIGN(4);
__export_parasite_args = .;
}
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