criu/compel/plugins/Makefile
Michael Holzheu 61e6c01d09 s390: Move -msoft-float/-fno-optimize-sibling-calls into compel Makefiles
We currently define "CFLAGS += -msoft-float -fno-optimize-sibling-calls"
in Makefile.compel.

Makefile.compel is included into the toplevel Makefile and so changes
CFLAGS which are exported to all criu and zdtm Makefiles.

We must not use -msoft-float outside the compel files. E.g. otherwise for
zdtm we get the following build error:

uptime_grow.o: In function `main':
/tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
/tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__muldf3'
/tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
/tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__adddf3

Fix this and move the CFLAGS definition to the compel Makefiles.
We do this by defining a new flag CFLAGS_PIE that is only used for pie code.

Reported-by: Adrian Reber <areber@redhat.com>
Suggested-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Tested-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-09 18:51:41 +03:00

100 lines
2.9 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
# Required for pie code
ccflags-y += $(CFLAGS_PIE)
# 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