criu/pie/Makefile
Laurent Dufour 7f01d691c7 vdso: Rework vdso processing files
There were multiple copy of the same code spread over the different
architectures handling the vDSO.

This patch is merging the duplicated code in arch/*/vdso-pie.c and
arch/*/include/asm/vdso.h in the common files and let only the architecture
specific part in the arch/*/* files.

The file are now organized this way:

include/asm-generic/vdso.h
	contains basic definition which could be overwritten by
	architectures.

arch/*/include/asm/vdso.h
	contains per architecture definitions.
	It may includes include/asm-generic/vdso.h

pie/util-vdso.c
include/util-vdso.h
	These files contains code and definitions common to both criu and
	the parasite code.
	The file include/util-vdso.h includes arch/*/include/asm/vdso.h.

pie/parsite-vdso.c
include/parasite-vdso.h
	contains code and definition specific to the parasite code handling
	the vDSO.
	The file include/parasite-vdso.h includes include/util-vdso.h.

arch/*/vdso-pie.c
	contains the architecture specific code installing the vDSO
	trampoline.

vdso.c
include/vdso.h
	contains code and definition specific to the criu code handling the
	vDSO.
	The file include/vdso.h includes include/util-vdso.h.

CC: Christopher Covington <cov@codeaurora.org>
CC: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-10 14:07:22 +03:00

129 lines
3.3 KiB
Makefile

targets += parasite
targets += restorer
obj-y += log-simple.o
obj-y += util.o
obj-y += util-fd.o
ifeq ($(VDSO),y)
obj-y += util-vdso.o
obj-y += parasite-vdso.o
obj-e += $(ARCH_DIR)/vdso-pie.o
ifeq ($(SRCARCH),aarch64)
asm-e += $(ARCH_DIR)/intraprocedure.o
endif
ifeq ($(SRCARCH), ppc64)
asm-e += $(ARCH_DIR)/vdso-trampoline.o
endif
endif
ifeq ($(SRCARCH), ppc64)
asm-e += $(ARCH_DIR)/memcpy_power7.o
asm-e += $(ARCH_DIR)/memcmp_64.o
asm-e += $(ARCH_DIR)/misc.o
endif
parasite-obj-y += parasite.o
parasite-asm-e += $(ARCH_DIR)/parasite-head.o
parasite-libs-e += $(SYSCALL-LIB)
restorer-obj-y += restorer.o
restorer-obj-e += $(ARCH_DIR)/restorer.o
restorer-libs-e += $(SYSCALL-LIB)
#
# 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)) -iquote pie/piegen
ifneq ($(filter-out i386 ia32, $(ARCH)),)
cflags-y += -DCR_NOGLIBC -fpie -Wa,--noexecstack -fno-stack-protector
else
cflags-y += -DCR_NOGLIBC -fno-pic -Wa,--noexecstack -fno-stack-protector
endif
ifeq ($(SRCARCH), arm)
cflags-y += -marm
endif
ASMFLAGS += -D__ASSEMBLY__
GEN-OFFSETS := ../scripts/gen-offsets.sh
BLOBS := $(obj)/parasite-blob.h $(obj)/restorer-blob.h
PIELDS := pie.lds.S
.SECONDARY:
ifeq ($(piegen-y),y)
ldflags-y += -r
target-name = $(patsubst pie/%-blob.h,%,$(1))
ifeq ($(SRCARCH),ppc64)
$(obj)/$(PIELDS): $(obj)/pie-reloc.lds.S.in
$(E) " GEN " $@
$(Q) echo "OUTPUT_ARCH($(LDARCH))" > $(obj)/$(PIELDS)
$(Q) cat $< >> $(obj)/$(PIELDS)
else
ifeq ($(ARCH),x86_64)
$(obj)/$(PIELDS): $(obj)/pie-reloc.lds.S.in
$(E) " GEN " $@
$(Q) echo "OUTPUT_ARCH(i386:x86-64)" > $(obj)/$(PIELDS)
$(Q) echo "TARGET(elf64-x86-64)" >> $(obj)/$(PIELDS)
$(Q) cat $< >> $(obj)/$(PIELDS)
else # i386 ia32
$(obj)/$(PIELDS): $(obj)/pie-reloc.lds.S.in
$(E) " GEN " $@
$(Q) echo "OUTPUT_ARCH(i386)" > $(obj)/$(PIELDS)
$(Q) echo "TARGET(elf32-i386)" >> $(obj)/$(PIELDS)
$(Q) cat $< >> $(obj)/$(PIELDS)
endif
endif
ifeq ($(strip $(V)),)
piegen_stdout = >/dev/null
endif
$(obj)/%.built-in.bin.o: $(obj)/%.built-in.o $(obj)/$(PIELDS)
$(E) " GEN " $@
$(Q) $(LD) $(ldflags-y) -T $(obj)/$(PIELDS) -o $@ $<
$(obj)/%-blob.h: $(obj)/%.built-in.bin.o $(obj)/$(PIELDS) pie/piegen
$(E) " GEN " $@
$(Q) pie/piegen/piegen -f $< -v $(call target-name,$@)_relocs -p $(call target-name,$@)_blob_offset__ -s $(call target-name,$@)_blob -o $@ $(piegen_stdout)
else
$(obj)/$(PIELDS): $(obj)/$(PIELDS).in
$(E) " GEN " $@
$(Q) $(SH) -c "echo 'OUTPUT_ARCH($(LDARCH))' > $(obj)/$(PIELDS)"
$(Q) $(SH) -c "cat $(obj)/$(PIELDS).in >> $(obj)/$(PIELDS)"
$(obj)/%.built-in.bin.o: $(obj)/%.built-in.o $(obj)/$(PIELDS)
$(E) " GEN " $@
$(Q) $(LD) $(ldflags-y) -T $(obj)/$(PIELDS) -o $@ $<
$(obj)/%.built-in.bin: $(obj)/%.built-in.bin.o
$(E) " GEN " $@
$(Q) $(OBJCOPY) -O binary $^ $@
$(obj)/%-blob.h: $(obj)/%.built-in.bin $(obj)/$(GEN-OFFSETS)
$(E) " GEN " $@
$(Q) $(SH) $(obj)/$(GEN-OFFSETS) $(@:-blob.h=) $(notdir $(@:-blob.h=)) $(CROSS_COMPILE) > $@
endif
$(BLOBS): $(obj)/$(PIELDS)
_all += $(BLOBS)
cleanup-y += $(obj)/$(PIELDS)
cleanup-y += $(obj)/*.bin
cleanup-y += $(BLOBS)
cleanup-y += $(obj)/*.built-in.bin.o
cleanup-y += $(obj)/*.built-in.bin
ifneq ($(MAKECMDGOALS),clean)
incdeps := y
endif