git: 885ff9ed3577 - main - math/blis: fix build with clang 19

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Tue, 27 Aug 2024 07:33:46 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/ports/commit/?id=885ff9ed357775138732cd058046d4e00b77287d

commit 885ff9ed357775138732cd058046d4e00b77287d
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-08-12 19:31:50 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-08-27 07:33:02 +0000

    math/blis: fix build with clang 19
    
    Clang 19 has removed support for the -mavx512pf and -mavx512er flags,
    for the Intel Xeon Phi (aka "Knights Landing"/knl or "Knights
    Mill"/knm) [1] [2].
    
    This causes fatal errors during configuration of math/blis:
    
        Compiling obj/x86_64/kernels/knl/1m/bli_dpackm_knl_asm_24x8.o ('knl' CFLAGS for kernels)
        cc: fatal error: unknown argument '-mavx512pf'; did you mean '-mavx512f'?
        gmake: *** [Makefile:653: obj/x86_64/kernels/knl/1m/bli_dpackm_knl_asm_24x8.o] Error 1
    
    Add an EXTRA_PATCHES entry to deal with this situation.
    
    Note that in the future, this may also have to be done for gcc 15 and
    later. In that case, the patch might be done unconditionally.
    
    [1] https://github.com/llvm/llvm-project/pull/75580
    [2] https://github.com/llvm/llvm-project/pull/92883
    
    PR:             280783
    Approved by:    maintainer timeout (2 weeks)
    MFH:            2024Q3
---
 math/blis/Makefile                                   |  4 ++++
 math/blis/files/extra-patch-config_knl_make__defs.mk | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/math/blis/Makefile b/math/blis/Makefile
index 2793d3538f46..baa73955f9e3 100644
--- a/math/blis/Makefile
+++ b/math/blis/Makefile
@@ -61,6 +61,10 @@ PLIST_SUB+=	ARCH="generic"
 
 .include <bsd.port.pre.mk>
 
+.if ${COMPILER_TYPE} == clang && ${COMPILER_VERSION} >= 190
+EXTRA_PATCHES+=	${PATCHDIR}/extra-patch-config_knl_make__defs.mk
+.endif
+
 .if ${CHOSEN_COMPILER_TYPE} == gcc
 USE_GCC=	yes
 .endif
diff --git a/math/blis/files/extra-patch-config_knl_make__defs.mk b/math/blis/files/extra-patch-config_knl_make__defs.mk
new file mode 100644
index 000000000000..e2b980ba641d
--- /dev/null
+++ b/math/blis/files/extra-patch-config_knl_make__defs.mk
@@ -0,0 +1,20 @@
+--- config/knl/make_defs.mk.orig	2022-04-01 13:12:06 UTC
++++ config/knl/make_defs.mk
+@@ -81,7 +81,7 @@ ifeq ($(CC_VENDOR),clang)
+ CKVECFLAGS     := -xMIC-AVX512
+ else
+ ifeq ($(CC_VENDOR),clang)
+-CKVECFLAGS     := -mavx512f -mavx512pf -mfpmath=sse -march=knl
++CKVECFLAGS     := -mavx512f -mfpmath=sse -march=knl
+ else
+ $(error gcc, icc, or clang is required for this configuration.)
+ endif
+@@ -105,7 +105,7 @@ ifeq ($(CC_VENDOR),clang)
+ CRVECFLAGS     := -xMIC-AVX512
+ else
+ ifeq ($(CC_VENDOR),clang)
+-CRVECFLAGS     := -march=knl -mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd -funsafe-math-optimizations -ffp-contract=fast
++CRVECFLAGS     := -march=knl -mno-avx512f -mno-avx512cd -funsafe-math-optimizations -ffp-contract=fast
+ else
+ $(error gcc, icc, or clang is required for this configuration.)
+ endif