[CRIU] [PATCH] s390: Move -msoft-float into compel Makefiles

Michael Holzheu holzheu at linux.vnet.ibm.com
Thu Jul 20 21:36:50 MSK 2017


We currently define CFLAGS+=-msoft-float 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 Makefile.

As compel/plugins/Makefile and compel/Makefile are called recursively,
changed CFLAGS will not be exported back to the top Makefile.

Reported-by: Adrian Reber <areber at redhat.com>
Reviewed-by: Dmitry Safonov <dsafonov at virtuozzo.com>
Signed-off-by: Michael Holzheu <holzheu at linux.vnet.ibm.com>
---
 Makefile.compel         | 10 ----------
 compel/Makefile         | 14 ++++++++++++++
 compel/plugins/Makefile | 14 ++++++++++++++
 3 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/Makefile.compel b/Makefile.compel
index 5c854e3..1ef7f8c 100644
--- a/Makefile.compel
+++ b/Makefile.compel
@@ -70,13 +70,3 @@ compel/$(LIBCOMPEL_SO): compel/$(LIBCOMPEL_A)
 compel-install-targets	+= compel/$(LIBCOMPEL_SO)
 compel-install-targets	+= compel/compel
 compel-install-targets	+= $(compel-plugins)
-
-#
-# Also ensure with -fno-optimize-sibling-calls that we don't create GOT
-# (Global Offset Table) relocations with gcc compilers that don't have
-# commit "S/390: Fix 64 bit sibcall".
-#
-ifeq ($(ARCH),s390)
-CFLAGS += -msoft-float -fno-optimize-sibling-calls
-HOSTCFLAGS += -msoft-float -fno-optimize-sibling-calls
-endif
diff --git a/compel/Makefile b/compel/Makefile
index 43d27f5..81b9614 100644
--- a/compel/Makefile
+++ b/compel/Makefile
@@ -34,6 +34,20 @@ CFLAGS			+= -DNO_RELOCS
 HOSTCFLAGS		+= -DNO_RELOCS
 endif
 
+#
+# We assume that compel code does not change floating point registers.
+# On s390 gcc uses fprs to cache gprs. Therefore disable floating point
+# with -msoft-float.
+#
+# Also ensure with -fno-optimize-sibling-calls that we don't create GOT
+# (Global Offset Table) relocations with gcc compilers that don't have
+# commit "S/390: Fix 64 bit sibcall".
+#
+ifeq ($(ARCH),s390)
+CFLAGS += -msoft-float -fno-optimize-sibling-calls
+HOSTCFLAGS += -msoft-float -fno-optimize-sibling-calls
+endif
+
 obj-y			+= src/main.o
 obj-y			+= arch/$(ARCH)/src/lib/handle-elf.o
 obj-y			+= src/lib/handle-elf.o
diff --git a/compel/plugins/Makefile b/compel/plugins/Makefile
index 7127425..948348f 100644
--- a/compel/plugins/Makefile
+++ b/compel/plugins/Makefile
@@ -8,6 +8,20 @@ PLUGIN_ARCH_DIR		:= compel/arch/$(ARCH)/plugins
 # CFLAGS, ASFLAGS, LDFLAGS
 
 #
+# We assume that compel code does not change floating point registers.
+# On s390 gcc uses fprs to cache gprs. Therefore disable floating point
+# with -msoft-float.
+#
+# Also ensure with -fno-optimize-sibling-calls that we don't create GOT
+# (Global Offset Table) relocations with gcc compilers that don't have
+# commit "S/390: Fix 64 bit sibcall".
+#
+ifeq ($(ARCH),s390)
+CFLAGS += -msoft-float -fno-optimize-sibling-calls
+HOSTCFLAGS += -msoft-float -fno-optimize-sibling-calls
+endif
+
+#
 # UAPI inclusion, referred as <compel/...>
 ccflags-y		+= -I compel/include/uapi
 asflags-y		+= -I compel/include/uapi
-- 
2.7.4



More information about the CRIU mailing list