git: 52f6e63ab365 - main - Fix the zfs build for arm64

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Fri, 24 Jun 2022 13:59:47 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=52f6e63ab3656b417d8dd2b905569707c90c9ecf

commit 52f6e63ab3656b417d8dd2b905569707c90c9ecf
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2022-06-24 13:16:50 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2022-06-24 13:50:12 +0000

    Fix the zfs build for arm64
    
    Remove -mgeneral-regs-only when building the arm64 blake3 code. It
    uses simd instructions so will use non-general purpose registers.
    
    Sponsored by:   The FreeBSD Foundation
---
 sys/conf/files.arm64     |  4 ++--
 sys/modules/zfs/Makefile | 10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64
index 52eb4de5fef3..256b67975092 100644
--- a/sys/conf/files.arm64
+++ b/sys/conf/files.arm64
@@ -156,8 +156,8 @@ cddl/dev/dtrace/aarch64/dtrace_asm.S		optional dtrace compile-with "${DTRACE_S}"
 cddl/dev/dtrace/aarch64/dtrace_subr.c		optional dtrace compile-with "${DTRACE_C}"
 cddl/dev/fbt/aarch64/fbt_isa.c			optional dtrace_fbt | dtraceall compile-with "${FBT_C}"
 
-contrib/openzfs/module/icp/asm-aarch64/blake3/b3_aarch64_sse2.S		optional zfs compile-with "${ZFS_S}"
-contrib/openzfs/module/icp/asm-aarch64/blake3/b3_aarch64_sse41.S	optional zfs compile-with "${ZFS_S}"
+contrib/openzfs/module/icp/asm-aarch64/blake3/b3_aarch64_sse2.S		optional zfs compile-with "${ZFS_S:N-mgeneral-regs-only}"
+contrib/openzfs/module/icp/asm-aarch64/blake3/b3_aarch64_sse41.S	optional zfs compile-with "${ZFS_S:N-mgeneral-regs-only}"
 
 ##
 ## ASoC support
diff --git a/sys/modules/zfs/Makefile b/sys/modules/zfs/Makefile
index 1a6912fb8ebd..9f54e60f6026 100644
--- a/sys/modules/zfs/Makefile
+++ b/sys/modules/zfs/Makefile
@@ -445,6 +445,16 @@ CFLAGS.zstd_lazy.c+= ${__ZFS_ZSTD_AARCH64_FLAGS}
 CFLAGS.zstd_ldm.c+= ${__ZFS_ZSTD_AARCH64_FLAGS}
 CFLAGS.zstd_opt.c+= ${__ZFS_ZSTD_AARCH64_FLAGS}
 
+b3_aarch64_sse2.o: b3_aarch64_sse2.S
+	${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${.IMPSRC} \
+	     -o ${.TARGET}
+	${CTFCONVERT_CMD}
+
+b3_aarch64_sse41.o: b3_aarch64_sse41.S
+	${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${.IMPSRC} \
+	     -o ${.TARGET}
+	${CTFCONVERT_CMD}
+
 .endif
 CFLAGS.zstd.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL}
 CFLAGS.entropy_common.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL}