mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-18 17:14:28 +00:00
The objective is to only do parasite code linking once -- when we link parasite objects with compel plugin(s). So, let's use ar (rather than ld) here. This way we'll have a single ld invocation with the proper flags (from compel ldflags) etc. There are two tricks in doing it: 1. The order of objects while linking is important. Therefore, compel plugins should be the last to add to ld command line. 2. Somehow ld doesn't want to include parasite-head.o in the output (probably because no one else references it), so we have to force it in with the modification to our linker scripts. NB: compel makefiles are still a big mess, but I'll get there. Acked-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Kir Kolyshkin <kir@openvz.org> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
98 lines
2.8 KiB
Makefile
98 lines
2.8 KiB
Makefile
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV) $(CFLAGS-ASAN),$(CFLAGS))
|
|
CFLAGS += -DCR_NOGLIBC -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
|
|
CFLAGS += -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0
|
|
|
|
PLUGIN_ARCH_DIR := compel/arch/$(ARCH)/plugins
|
|
|
|
#
|
|
# CFLAGS, ASFLAGS, LDFLAGS
|
|
|
|
#
|
|
# UAPI inclusion, referred as <compel/...>
|
|
ccflags-y += -I compel/include/uapi
|
|
asflags-y += -I compel/include/uapi
|
|
|
|
# General compel includes
|
|
ccflags-y += -iquote compel/include
|
|
ccflags-y += -fpie -fno-stack-protector
|
|
|
|
# General compel/plugins includes
|
|
ccflags-y += -iquote $(obj)/include
|
|
asflags-y += -iquote $(obj)/include
|
|
|
|
# Arch compel/plugins includes
|
|
ccflags-y += -iquote $(PLUGIN_ARCH_DIR)/include
|
|
asflags-y += -iquote $(PLUGIN_ARCH_DIR)/include
|
|
asflags-y += -iquote $(PLUGIN_ARCH_DIR)
|
|
|
|
# General flags for assembly
|
|
asflags-y += -fpie -Wstrict-prototypes
|
|
asflags-y += -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
|
|
asflags-y += -fno-stack-protector
|
|
ldflags-y += -z noexecstack
|
|
|
|
#
|
|
# Shmem plugin
|
|
target += shmem
|
|
shmem-lib-y += shmem/shmem.o
|
|
|
|
#
|
|
# STD plugin
|
|
target += std
|
|
std-lib-y += std/std.o
|
|
std-lib-y += std/fds.o
|
|
std-lib-y += std/log.o
|
|
std-lib-y += std/string.o
|
|
std-lib-y += std/infect.o
|
|
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/parasite-head.o
|
|
|
|
#
|
|
# FDS plugin
|
|
target += fds
|
|
fds-lib-y += fds/fds.o
|
|
|
|
ifeq ($(SRCARCH),x86)
|
|
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/memcpy.o
|
|
endif
|
|
|
|
ifeq ($(SRCARCH),ppc64)
|
|
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/memcpy.o
|
|
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/memcmp.o
|
|
endif
|
|
|
|
include ./$(PLUGIN_ARCH_DIR)/std/syscalls/Makefile.syscalls
|
|
|
|
define syscall-priority
|
|
$(addprefix $(obj)/,$($(1):%.o=%.d)): | $($(2))
|
|
$(addprefix $(obj)/,$($(1):%.o=%.i)): | $($(2))
|
|
$(addprefix $(obj)/,$($(1):%.o=%.s)): | $($(2))
|
|
$(addprefix $(obj)/,$($(1))): | $($(2))
|
|
endef
|
|
|
|
#
|
|
# Almost all plugins depen on syscall headers
|
|
# and definitions so we have to order their
|
|
# generation manually.
|
|
$(foreach t,$(target),$(eval $(call syscall-priority,$(t)-lib-y,std-headers-deps)))
|
|
|
|
#
|
|
# FIXME syscall-types.h should be setup earlier
|
|
#
|
|
install: compel/plugins/std.lib.a compel/plugins/fds.lib.a
|
|
$(E) " INSTALL " compel plugins
|
|
$(Q) mkdir -p $(DESTDIR)$(LIBEXECDIR)/compel/
|
|
$(Q) install -m 0644 $^ $(DESTDIR)$(LIBEXECDIR)/compel/
|
|
$(Q) mkdir -p $(DESTDIR)$(LIBEXECDIR)/compel/scripts
|
|
$(Q) install -m 0644 compel/arch/$(ARCH)/scripts/compel-pack.lds.S $(DESTDIR)$(LIBEXECDIR)/compel/scripts
|
|
$(E) " INSTALL " compel plugins uapi
|
|
$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)/compel/plugins
|
|
$(Q) cp -frL compel/plugins/include/uapi/* $(DESTDIR)$(INCLUDEDIR)/compel/plugins/
|
|
.PHONY: install
|
|
|
|
uninstall:
|
|
$(E) " UNINSTALL" compel plugins
|
|
$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBEXECDIR)/compel/,*.lib.a)
|
|
$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBEXECDIR)/compel/scripts/,compel-pack.lds.S)
|
|
$(E) " UNINSTALL" compel and plugins uapi
|
|
$(Q) $(RM) -rf $(addprefix $(DESTDIR)$(INCLUDEDIR)/,compel/plugins)
|
|
.PHONY: uninstall
|