[CRIU] [PATCH v2] s390: Move -msoft-float/-fno-optimize-sibling-calls into compel Makefiles

Michael Holzheu holzheu at linux.vnet.ibm.com
Fri Jul 21 14:49:43 MSK 2017


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 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>
Signed-off-by: Michael Holzheu <holzheu at linux.vnet.ibm.com>
---
 Makefile.compel           | 10 ----------
 compel/Makefile           | 14 ++++++++++++++
 compel/plugins/Makefile   | 14 ++++++++++++++
 criu/pie/Makefile         |  8 +++++++-
 criu/pie/Makefile.library |  9 ++++++++-
 5 files changed, 43 insertions(+), 12 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
diff --git a/criu/pie/Makefile b/criu/pie/Makefile
index 76c3535..1f844cc 100644
--- a/criu/pie/Makefile
+++ b/criu/pie/Makefile
@@ -16,11 +16,17 @@ ifeq ($(SRCARCH),arm)
 	ccflags-y	+= -marm
 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 ($(SRCARCH),s390)
-	ccflags-y	+= -msoft-float
+	ccflags-y	+= -msoft-float -fno-optimize-sibling-calls
 endif
 
 asflags-y	+= -D__ASSEMBLY__
diff --git a/criu/pie/Makefile.library b/criu/pie/Makefile.library
index ceadc1d..a532dd3 100644
--- a/criu/pie/Makefile.library
+++ b/criu/pie/Makefile.library
@@ -41,9 +41,16 @@ ccflags-y		+= $(COMPEL_UAPI_INCLUDES)
 ifeq ($(SRCARCH),arm)
 	ccflags-y	+= -marm
 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 ($(SRCARCH),s390)
-	ccflags-y	+= -msoft-float
+	ccflags-y	+= -msoft-float -fno-optimize-sibling-calls
 endif
-- 
2.7.4



More information about the CRIU mailing list