mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
compel: make plugins .a archives
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>
This commit is contained in:
parent
af572b3cf5
commit
8b99809a4e
11 changed files with 47 additions and 25 deletions
|
|
@ -1,8 +1,12 @@
|
|||
OUTPUT_ARCH(aarch64)
|
||||
EXTERN(__export_parasite_head_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.crblob 0x0 : {
|
||||
*(.head.text)
|
||||
ASSERT(DEFINED(__export_parasite_head_start),
|
||||
"Symbol __export_parasite_head_start is missing");
|
||||
*(.text*)
|
||||
. = ALIGN(32);
|
||||
*(.data*)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ sys-gen := $(PLUGIN_ARCH_DIR)/std/syscalls/gen-syscalls.pl
|
|||
sys-gen-tbl := $(PLUGIN_ARCH_DIR)/std/syscalls/gen-sys-exec-tbl.pl
|
||||
|
||||
sys-asm := ./$(PLUGIN_ARCH_DIR)/std/syscalls/syscalls.S
|
||||
std-obj-y += $(sys-asm:.S=).o
|
||||
std-lib-y += $(sys-asm:.S=).o
|
||||
|
||||
ifeq ($(ARCH),arm)
|
||||
arch_bits := 32
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
OUTPUT_ARCH(arm)
|
||||
EXTERN(__export_parasite_head_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.crblob 0x0 : {
|
||||
*(.head.text)
|
||||
ASSERT(DEFINED(__export_parasite_head_start),
|
||||
"Symbol __export_parasite_head_start is missing");
|
||||
*(.text*)
|
||||
. = ALIGN(32);
|
||||
*(.data*)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ sys-asm-types := $(obj)/include/uapi/std/asm/syscall-types.h
|
|||
sys-exec-tbl = $(PLUGIN_ARCH_DIR)/std/sys-exec-tbl.c
|
||||
|
||||
sys-asm := ./$(PLUGIN_ARCH_DIR)/std/syscalls/syscalls.S
|
||||
std-obj-y += $(sys-asm:.S=).o
|
||||
std-lib-y += $(sys-asm:.S=).o
|
||||
|
||||
$(sys-codes): $(sys-def)
|
||||
$(E) " GEN " $@
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
OUTPUT_ARCH(powerpc:common64)
|
||||
EXTERN(__export_parasite_head_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text : {
|
||||
*(.head.text)
|
||||
ASSERT(DEFINED(__export_parasite_head_start),
|
||||
"Symbol __export_parasite_head_start is missing");
|
||||
*(.text*)
|
||||
*(.compel.exit)
|
||||
*(.compel.init)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
std-obj-y += ./$(PLUGIN_ARCH_DIR)/std/syscalls-64.o
|
||||
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/syscalls-64.o
|
||||
|
||||
sys-proto-types := $(obj)/include/uapi/std/syscall-types.h
|
||||
sys-proto-generic := $(obj)/include/uapi/std/syscall.h
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
OUTPUT_ARCH(i386)
|
||||
TARGET(elf32-i386)
|
||||
EXTERN(__export_parasite_head_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text : {
|
||||
*(.head.text)
|
||||
ASSERT(DEFINED(__export_parasite_head_start),
|
||||
"Symbol __export_parasite_head_start is missing");
|
||||
*(.text*)
|
||||
*(.compel.exit)
|
||||
*(.compel.init)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
OUTPUT_ARCH(i386:x86-64)
|
||||
TARGET(elf64-x86-64)
|
||||
EXTERN(__export_parasite_head_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text : {
|
||||
*(.head.text)
|
||||
ASSERT(DEFINED(__export_parasite_head_start),
|
||||
"Symbol __export_parasite_head_start is missing");
|
||||
*(.text*)
|
||||
*(.compel.exit)
|
||||
*(.compel.init)
|
||||
|
|
|
|||
|
|
@ -34,30 +34,30 @@ ldflags-y += -z noexecstack
|
|||
#
|
||||
# Shmem plugin
|
||||
target += shmem
|
||||
shmem-obj-y += shmem/shmem.o
|
||||
shmem-lib-y += shmem/shmem.o
|
||||
|
||||
#
|
||||
# STD plugin
|
||||
target += std
|
||||
std-obj-y += std/std.o
|
||||
std-obj-y += std/fds.o
|
||||
std-obj-y += std/log.o
|
||||
std-obj-y += std/string.o
|
||||
std-obj-y += std/infect.o
|
||||
std-obj-y += ./$(PLUGIN_ARCH_DIR)/std/parasite-head.o
|
||||
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-obj-y += fds/fds.o
|
||||
fds-lib-y += fds/fds.o
|
||||
|
||||
ifeq ($(SRCARCH),x86)
|
||||
std-obj-y += ./$(PLUGIN_ARCH_DIR)/std/memcpy.o
|
||||
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/memcpy.o
|
||||
endif
|
||||
|
||||
ifeq ($(SRCARCH),ppc64)
|
||||
std-obj-y += ./$(PLUGIN_ARCH_DIR)/std/memcpy.o
|
||||
std-obj-y += ./$(PLUGIN_ARCH_DIR)/std/memcmp.o
|
||||
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
|
||||
|
|
@ -73,15 +73,15 @@ 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)-obj-y,std-headers-deps)))
|
||||
$(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.built-in.o
|
||||
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 compel/plugins/std.built-in.o $(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
|
||||
|
|
@ -91,7 +91,7 @@ install: compel/plugins/std.built-in.o
|
|||
|
||||
uninstall:
|
||||
$(E) " UNINSTALL" compel plugins
|
||||
$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBEXECDIR)/compel/,std.built-in.o)
|
||||
$(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)
|
||||
|
|
|
|||
|
|
@ -186,12 +186,14 @@ static void print_ldflags(bool compat)
|
|||
|
||||
static void print_plugins(const char *list[])
|
||||
{
|
||||
const char suffix[] = ".lib.a";
|
||||
|
||||
while (*list != NULL) {
|
||||
if (uninst_root)
|
||||
printf("%s/plugins/%s.built-in.o\n",
|
||||
uninst_root, *list);
|
||||
printf("%s/plugins/%s%s\n",
|
||||
uninst_root, *list, suffix);
|
||||
else
|
||||
printf("%s/compel/%s.built-in.o\n", LIBEXECDIR, *list);
|
||||
printf("%s/compel/%s%s\n", LIBEXECDIR, *list, suffix);
|
||||
list++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue