This should fix the build on s390x.

This commit is contained in:
Susi Lehtola 2020-06-16 19:36:41 +02:00
parent a23aac5aed
commit 4ab33d8758
2 changed files with 94 additions and 1 deletions

89
2669.patch Normal file
View File

@ -0,0 +1,89 @@
From a2d13ea61183099c05aa31e23ef59e1411d77177 Mon Sep 17 00:00:00 2001
From: Marius Hillenbrand <mhillen@linux.ibm.com>
Date: Tue, 16 Jun 2020 14:40:50 +0200
Subject: [PATCH 1/2] Fix gcc version detection for zarch
Employ common variables for gcc version detection and fix the broken
check for gcc >= 5.2.
Fixes #2668
Signed-off-by: Marius Hillenbrand <mhillen@linux.ibm.com>
---
Makefile.system | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/Makefile.system b/Makefile.system
index 8d78b420f..5738b14ec 100644
--- a/Makefile.system
+++ b/Makefile.system
@@ -282,9 +282,11 @@ endif
ifeq ($(C_COMPILER), GCC)
GCCVERSIONGTEQ4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4)
GCCVERSIONGT4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 4)
+GCCVERSIONEQ5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` = 5)
GCCVERSIONGT5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 5)
GCCVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 7)
GCCVERSIONGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9)
+GCCMINORVERSIONGTEQ2 := $(shell expr `$(CC) -dumpversion | cut -f2 -d.` \>= 2)
GCCMINORVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f2 -d.` \>= 7)
endif
@@ -570,20 +572,27 @@ ifeq ($(ARCH), zarch)
DYNAMIC_CORE = ZARCH_GENERIC
# Z13 is supported since gcc-5.2, gcc-6, and in RHEL 7.3 and newer
-GCC_GE_52 := $(subst 0,,$(shell expr `$(CC) -dumpversion` \>= "5.2"))
+ifeq ($(GCCVERSIONGT5), 1)
+ ZARCH_SUPPORT_Z13 := 1
+else ifeq ($(GCCVERSIONEQ5), 1)
+ifeq ($(GCCMINORVERSIONGTEQ2), 1)
+ ZARCH_SUPPORT_Z13 := 1
+endif
+endif
ifeq ($(wildcard /etc/redhat-release), /etc/redhat-release)
-RHEL_WITH_Z13 := $(subst 0,,$(shell source /etc/os-release ; expr $$VERSION_ID \>= "7.3"))
+ifeq ($(shell source /etc/os-release ; expr $$VERSION_ID \>= "7.3"), 1)
+ ZARCH_SUPPORT_Z13 := 1
+endif
endif
-ifeq ($(or $(GCC_GE_52),$(RHEL_WITH_Z13)), 1)
+ifeq ($(ZARCH_SUPPORT_Z13), 1)
DYNAMIC_CORE += Z13
else
$(info OpenBLAS: Not building Z13 kernels because gcc is older than 5.2 or 6.x)
endif
-GCC_MAJOR_GE_7 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 7)
-ifeq ($(GCC_MAJOR_GE_7), 1)
+ifeq ($(GCCVERSIONGTEQ7), 1)
DYNAMIC_CORE += Z14
else
$(info OpenBLAS: Not building Z14 kernels because gcc is older than 7.x)
From 23892917667d87072eef2f18b6120f5d3c029f90 Mon Sep 17 00:00:00 2001
From: Marius Hillenbrand <mhillen@linux.ibm.com>
Date: Tue, 16 Jun 2020 14:45:09 +0200
Subject: [PATCH 2/2] Makefile.system: remove duplicate variable GCCVERSIONGT5
... to bring unified gcc version detection with common variables to the
one remaining spot in Makefile.system.
Signed-off-by: Marius Hillenbrand <mhillen@linux.ibm.com>
---
Makefile.system | 1 -
1 file changed, 1 deletion(-)
diff --git a/Makefile.system b/Makefile.system
index 5738b14ec..63cdbccd8 100644
--- a/Makefile.system
+++ b/Makefile.system
@@ -606,7 +606,6 @@ ifneq ($(C_COMPILER), GCC)
DYNAMIC_CORE += POWER9
endif
ifeq ($(C_COMPILER), GCC)
-GCCVERSIONGT5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 5)
ifeq ($(GCCVERSIONGT5), 1)
DYNAMIC_CORE += POWER9
else

View File

@ -29,6 +29,9 @@ Patch2: openblas-0.2.15-constructor.patch
# Supply the proper flags to the test makefile
Patch3: openblas-0.3.7-tests.patch
# Fix broken detection for z13 support
Patch4: https://patch-diff.githubusercontent.com/raw/xianyi/OpenBLAS/pull/2669.patch
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: gcc-gfortran
@ -241,6 +244,7 @@ cd OpenBLAS-%{version}
%patch2 -p1 -b .constructor
%endif
%patch3 -p1 -b .tests
%patch4 -p1 -b .s390x
# Fix source permissions
find -name \*.f -exec chmod 644 {} \;
@ -380,7 +384,7 @@ TARGET="TARGET=POWER8 DYNAMIC_ARCH=1 DYNAMIC_OLDER=1"
TARGET="TARGET=ARMV8 DYNAMIC_ARCH=1 DYNAMIC_OLDER=1"
%endif
%ifarch s390x
TARGET="TARGET=ZARCH_GENERIC DYNAMIC_ARCH=1"
TARGET="TARGET=ZARCH_GENERIC DYNAMIC_ARCH=1 DYNAMIC_OLDER=1"
%endif
%if 0%{?rhel} == 5