Commit 61e6c01d authored by Michael Holzheu's avatar Michael Holzheu Committed by Pavel Emelyanov

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: 's avatarAdrian Reber <areber@redhat.com>
Suggested-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarMichael Holzheu <holzheu@linux.vnet.ibm.com>
Reviewed-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Tested-by: 's avatarAdrian Reber <areber@redhat.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 602a948d
...@@ -65,12 +65,24 @@ ifeq ($(ARCH),x86) ...@@ -65,12 +65,24 @@ ifeq ($(ARCH),x86)
DEFINES := -DCONFIG_X86_64 DEFINES := -DCONFIG_X86_64
endif endif
#
# CFLAGS_PIE:
#
# 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) ifeq ($(ARCH),s390)
ARCH := s390 ARCH := s390
SRCARCH := s390 SRCARCH := s390
VDSO := y VDSO := y
DEFINES := -DCONFIG_S390 DEFINES := -DCONFIG_S390
CFLAGS_PIE := -msoft-float -fno-optimize-sibling-calls
endif endif
export CFLAGS_PIE
LDARCH ?= $(SRCARCH) LDARCH ?= $(SRCARCH)
export LDARCH VDSO export LDARCH VDSO
......
...@@ -70,13 +70,3 @@ compel/$(LIBCOMPEL_SO): compel/$(LIBCOMPEL_A) ...@@ -70,13 +70,3 @@ compel/$(LIBCOMPEL_SO): compel/$(LIBCOMPEL_A)
compel-install-targets += compel/$(LIBCOMPEL_SO) compel-install-targets += compel/$(LIBCOMPEL_SO)
compel-install-targets += compel/compel compel-install-targets += compel/compel
compel-install-targets += $(compel-plugins) 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
...@@ -11,6 +11,7 @@ ccflags-y += -iquote compel/arch/$(ARCH)/src/lib/include ...@@ -11,6 +11,7 @@ ccflags-y += -iquote compel/arch/$(ARCH)/src/lib/include
ccflags-y += -iquote compel/include ccflags-y += -iquote compel/include
ccflags-y += -fno-strict-aliasing ccflags-y += -fno-strict-aliasing
ccflags-y += -fPIC ccflags-y += -fPIC
ccflags-y += $(CFLAGS_PIE)
ldflags-y += -r ldflags-y += -r
# #
......
...@@ -7,7 +7,9 @@ PLUGIN_ARCH_DIR := compel/arch/$(ARCH)/plugins ...@@ -7,7 +7,9 @@ PLUGIN_ARCH_DIR := compel/arch/$(ARCH)/plugins
# #
# CFLAGS, ASFLAGS, LDFLAGS # CFLAGS, ASFLAGS, LDFLAGS
# # Required for pie code
ccflags-y += $(CFLAGS_PIE)
# UAPI inclusion, referred as <compel/...> # UAPI inclusion, referred as <compel/...>
ccflags-y += -I compel/include/uapi ccflags-y += -I compel/include/uapi
asflags-y += -I compel/include/uapi asflags-y += -I compel/include/uapi
......
...@@ -2,6 +2,7 @@ target := parasite restorer ...@@ -2,6 +2,7 @@ target := parasite restorer
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV) $(CFLAGS-ASAN),$(CFLAGS)) CFLAGS := $(filter-out -pg $(CFLAGS-GCOV) $(CFLAGS-ASAN),$(CFLAGS))
ccflags-y += $(COMPEL_UAPI_INCLUDES) ccflags-y += $(COMPEL_UAPI_INCLUDES)
ccflags-y += $(CFLAGS_PIE)
ccflags-y += -DCR_NOGLIBC ccflags-y += -DCR_NOGLIBC
ccflags-y += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 ccflags-y += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
ccflags-y += -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0 ccflags-y += -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0
...@@ -16,13 +17,6 @@ ifeq ($(SRCARCH),arm) ...@@ -16,13 +17,6 @@ ifeq ($(SRCARCH),arm)
ccflags-y += -marm ccflags-y += -marm
endif 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.
ifeq ($(SRCARCH),s390)
ccflags-y += -msoft-float
endif
asflags-y += -D__ASSEMBLY__ asflags-y += -D__ASSEMBLY__
LDS := compel/arch/$(SRCARCH)/scripts/compel-pack.lds.S LDS := compel/arch/$(SRCARCH)/scripts/compel-pack.lds.S
......
...@@ -37,13 +37,9 @@ CFLAGS := $(filter-out -pg $(CFLAGS-GCOV) $(CFLAGS-ASAN),$(CFLAGS)) ...@@ -37,13 +37,9 @@ CFLAGS := $(filter-out -pg $(CFLAGS-GCOV) $(CFLAGS-ASAN),$(CFLAGS))
asflags-y := -D__ASSEMBLY__ asflags-y := -D__ASSEMBLY__
ccflags-y += $(COMPEL_UAPI_INCLUDES) ccflags-y += $(COMPEL_UAPI_INCLUDES)
ccflags-y += $(CFLAGS_PIE)
ifeq ($(SRCARCH),arm) ifeq ($(SRCARCH),arm)
ccflags-y += -marm ccflags-y += -marm
endif 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.
ifeq ($(SRCARCH),s390)
ccflags-y += -msoft-float
endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment