diff --git a/config/toolchain-cfi.m4 b/config/toolchain-cfi.m4 new file mode 100644 index 000000000000..f1ad2b23934d --- /dev/null +++ b/config/toolchain-cfi.m4 @@ -0,0 +1,33 @@ +dnl # SPDX-License-Identifier: CDDL-1.0 +dnl # +dnl # Check whether assembler supports .cfi_negate_ra_state on AArch64. +dnl # + +AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_CFI_PSEUDO_OP], [ + case "$host_cpu" in + aarch64*) + AC_CACHE_CHECK([whether assembler supports .cfi_negate_ra_state], + [zfs_cv_as_cfi_pseudo_op], [ + cat > conftest.S <<_ACEOF + .text +conftest: + .cfi_startproc + .cfi_negate_ra_state + ret + .cfi_endproc +_ACEOF + if AC_TRY_COMMAND([$CC -c $CFLAGS $CPPFLAGS conftest.S -o conftest.o]) >/dev/null 2>&1; then + zfs_cv_as_cfi_pseudo_op=yes + else + zfs_cv_as_cfi_pseudo_op=no + fi + rm -f conftest.S conftest.o + ]) + + AS_IF([test "x$zfs_cv_as_cfi_pseudo_op" = xyes], [ + AC_DEFINE([HAVE_AS_CFI_PSEUDO_OP], 1, + [Define if your assembler supports .cfi_negate_ra_state.]) + ]) + ;; + esac +]) diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index 92c34b87bddd..1e1485c4cf46 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -266,6 +266,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [ ZFS_AC_CONFIG_ALWAYS_CC_ASAN ZFS_AC_CONFIG_ALWAYS_CC_UBSAN ZFS_AC_TOOLCHAIN_SIMD + ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_CFI_PSEUDO_OP ZFS_AC_CONFIG_ALWAYS_SYSTEM ZFS_AC_CONFIG_ALWAYS_ARCH ZFS_AC_CONFIG_CHECK_ARCH_VAR diff --git a/module/icp/asm-aarch64/blake3/b3_aarch64_sse2.S b/module/icp/asm-aarch64/blake3/b3_aarch64_sse2.S index 19fd94921456..a6f1d78f7e2d 100644 --- a/module/icp/asm-aarch64/blake3/b3_aarch64_sse2.S +++ b/module/icp/asm-aarch64/blake3/b3_aarch64_sse2.S @@ -34,8 +34,8 @@ #if defined(__aarch64__) -/* make gcc <= 9 happy */ -#if !defined(LD_VERSION) || LD_VERSION >= 233010000 +/* check for .cfi_negate_ra_state assembler support */ +#if defined(HAVE_AS_CFI_PSEUDO_OP) #define CFI_NEGATE_RA_STATE .cfi_negate_ra_state #else #define CFI_NEGATE_RA_STATE diff --git a/module/icp/asm-aarch64/blake3/b3_aarch64_sse41.S b/module/icp/asm-aarch64/blake3/b3_aarch64_sse41.S index a7dc13d1e2cd..65098a03e8b5 100644 --- a/module/icp/asm-aarch64/blake3/b3_aarch64_sse41.S +++ b/module/icp/asm-aarch64/blake3/b3_aarch64_sse41.S @@ -34,8 +34,8 @@ #if defined(__aarch64__) -/* make gcc <= 9 happy */ -#if !defined(LD_VERSION) || LD_VERSION >= 233010000 +/* check for .cfi_negate_ra_state assembler support */ +#if defined(HAVE_AS_CFI_PSEUDO_OP) #define CFI_NEGATE_RA_STATE .cfi_negate_ra_state #else #define CFI_NEGATE_RA_STATE