Commit 2f481f02 authored by Laurent Dufour's avatar Laurent Dufour Committed by Pavel Emelyanov

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: 's avatarLaurent Dufour <ldufour@linux.vnet.ibm.com>
Reviewed-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 61859d11
......@@ -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'.
......
......@@ -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
......
......@@ -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
......
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)
......
......@@ -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), \
......
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