From 558b9b8777c22b98d5173ed1bf9794de9c1bdd2b Mon Sep 17 00:00:00 2001 From: zhaozhen Date: Thu, 9 Mar 2023 20:31:47 +0800 Subject: [PATCH] add loongarch support for openblas --- 0001-modify-the-ABI-for-loongarch.patch | 27 +++++++++++++++++++++++++ openblas.spec | 12 +++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 0001-modify-the-ABI-for-loongarch.patch diff --git a/0001-modify-the-ABI-for-loongarch.patch b/0001-modify-the-ABI-for-loongarch.patch new file mode 100644 index 0000000..83c81d7 --- /dev/null +++ b/0001-modify-the-ABI-for-loongarch.patch @@ -0,0 +1,27 @@ +From b13db2656d6e983a77b3d203b4af51ba15f2f815 Mon Sep 17 00:00:00 2001 +From: zhaozhen +Date: Thu, 9 Mar 2023 11:50:01 +0000 +Subject: [PATCH] modify the ABI for loongarch64 + +--- + OpenBLAS-0.3.18/Makefile.system | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git OpenBLAS-0.3.18/Makefile.system OpenBLAS-0.3.18/Makefile.system +index 150dbef..f9101af 100644 +--- OpenBLAS-0.3.18/Makefile.system ++++ OpenBLAS-0.3.18/Makefile.system +@@ -869,8 +869,8 @@ endif + + ifeq ($(ARCH), loongarch64) + ifeq ($(CORE), LOONGSON3R5) +-CCOMMON_OPT += -march=loongarch64 -mabi=lp64 +-FCOMMON_OPT += -march=loongarch64 -mabi=lp64 ++CCOMMON_OPT += -march=loongarch64 -mabi=lp64d ++FCOMMON_OPT += -march=loongarch64 -mabi=lp64d + endif + endif + +-- +2.33.0 + diff --git a/openblas.spec b/openblas.spec index aa553d7..1672a2b 100644 --- a/openblas.spec +++ b/openblas.spec @@ -2,7 +2,7 @@ Name: openblas Version: 0.3.18 -Release: 2 +Release: 3 Summary: An optimized BLAS library based on GotoBLAS2 1.13 BSD version License: BSD-3-Clause URL: https://github.com/xianyi/OpenBLAS/ @@ -10,6 +10,7 @@ Source0: https://github.com/xianyi/OpenBLAS/archive/v%{version}/openblas- Patch0000: openblas-0.2.15-system_lapack.patch Patch0001: openblas-0.2.5-libname.patch Patch0002: openblas-0.3.7-tests.patch +Patch0003: 0001-modify-the-ABI-for-loongarch.patch Requires: %{name}-devel = %{version}-%{release} BuildRequires: gcc gcc-gfortran perl-devel gcc-c++ @@ -34,7 +35,7 @@ Obsoletes: openblas-serial64_ < %{version}-%{release} openblas-openmp64_ < Obsoletes: openblas-threads64_ < %{version}-%{release} openblas-Rblas < %{version}-%{release} Obsoletes: openblas-static < %{version}-%{release} -ExclusiveArch: x86_64 aarch64 +ExclusiveArch: x86_64 aarch64 loongarch64 %description OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD \ @@ -57,6 +58,7 @@ cd OpenBLAS-%{version} %endif %patch0001 -p1 -b .libname %patch0002 -p1 -b .tests +%patch0003 -p1 # Set source permissions find -name \*.f -exec chmod 644 {} \; @@ -213,6 +215,9 @@ cp -a %{_includedir}/lapacke %{buildroot}%{_includedir}/%{name} %endif # Fix name of libraries +%ifarch loongarch64 +suffix="_loongson3r5" +%endif slibname=`basename %{buildroot}%{_libdir}/libopenblas${suffix}-*.so .so` mv %{buildroot}%{_libdir}/${slibname}.a %{buildroot}%{_libdir}/lib%{name}.a if [[ "$suffix" != "" ]]; then @@ -351,6 +356,9 @@ rm -rf %{buildroot}%{_libdir}/pkgconfig %{_libdir}/lib%{name}*64_.so %changelog +* Thu Mar 9 2023 zhaozhen - 0.3.18-3 +- add loongarch support for openblas + * Wed May 11 2022 wulei - 0.3.18-2 - License compliance rectification