2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

Build pie objects separately

This patch change the build chain to not use pie objects in the crtools
executable.

This done by building the shared source files twice:
 1. for parasite/restorer as '<file>-pie-build.o'
 2. for crtools as '<file>.o'

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Laurent Dufour 2015-10-12 17:17:00 +03:00 committed by Pavel Emelyanov
parent 61859d1176
commit 2f481f02fc
5 changed files with 26 additions and 11 deletions

View File

@ -57,6 +57,11 @@ obj-y::
Source code C file. Typically refered as *obj-y += 'some-file.o'*.
This implies you have real 'some-file.c' in '$(obj)' directory.
obj-x::
Same as 'obj-y' but the output files have the suffix $(xsuffix).
This is used when building shared source file for both pie and crtools
The posfix '-x' came from word 'extra'.
obj-e::
Same as 'obj-y' but implies that source code file lays in directory
other than '$(obj)'. The postfix '-e' came from word 'external'.

View File

@ -225,8 +225,6 @@ $(piegen): pie/piegen/built-in.o
.PHONY: pie/piegen
endif
pie/%:: $(ARCH_DIR) $(piegen)
$(Q) $(MAKE) $(build)=pie $@
pie: $(ARCH_DIR) $(piegen)
$(Q) $(MAKE) $(build)=pie all
@ -240,12 +238,6 @@ lib/%:: $(VERSION_HEADER) config built-in.o
lib: $(VERSION_HEADER) config built-in.o
$(Q) $(MAKE) $(build)=lib all
ifeq ($(VDSO),y)
PROGRAM-BUILTINS += pie/util-vdso.o
endif
PROGRAM-BUILTINS += pie/util-fd.o
PROGRAM-BUILTINS += pie/util.o
PROGRAM-BUILTINS += protobuf/built-in.o
PROGRAM-BUILTINS += built-in.o

View File

@ -67,6 +67,7 @@ obj-y += sigframe.o
obj-y += lsm.o
ifeq ($(VDSO),y)
obj-y += vdso.o
obj-y += pie/util-vdso.o
endif
obj-y += cr-service.o
obj-y += sd-daemon.o
@ -74,6 +75,8 @@ obj-y += plugin.o
obj-y += cr-errno.o
obj-y += pie/pie-relocs.o
obj-y += seize.o
obj-y += pie/util-fd.o
obj-y += pie/util.o
ifneq ($(MAKECMDGOALS),clean)
incdeps := y

View File

@ -1,12 +1,15 @@
targets += parasite
targets += restorer
# used by obj-x to identify shared files built for parasite/restorer binaries
xsuffix := -pie-build
obj-y += log-simple.o
obj-y += util.o
obj-y += util-fd.o
obj-x += util.o
obj-x += util-fd.o
ifeq ($(VDSO),y)
obj-y += util-vdso.o
obj-x += util-vdso.o
obj-y += parasite-vdso.o
obj-e += $(ARCH_DIR)/vdso-pie.o
ifeq ($(SRCARCH),aarch64)

View File

@ -64,6 +64,18 @@ all-objs += $(obj-y)
deps += $(obj-y:.o=.d)
endif
ifneq ($(obj-x),)
obj-x := $(addprefix $(obj)/, $(obj-x))
obj-x := $(addsuffix $(xsuffix).o, $(obj-x:.o=))
$(foreach file, \
$(obj-x), \
$(eval \
$(call gen-target-c-bundle, \
$(file:$(xsuffix).o=),$(file:.o=))))
all-objs += $(obj-x)
deps += $(obj-x:.o=.d)
endif
ifneq ($(obj-e),)
$(foreach file, \
$(obj-e), \