From bce36e21cac2d9d59b7a9d18e8d219ea73623ec8 Mon Sep 17 00:00:00 2001 From: Shengqi Chen Date: Wed, 22 Nov 2023 21:58:47 +0800 Subject: [PATCH] module/icp/asm-arm/sha2: auto detect __ARM_ARCH This patch uses __ARM_ARCH set by compiler (both GCC and Clang have this) whenever possible instead of hardcoding it to 7. This change allows code to compile on earlier ARM architectures such as armv5te. Reviewed-by: Brian Behlendorf Signed-off-by: Shengqi Chen Closes #15557 --- module/icp/asm-arm/sha2/sha256-armv7.S | 7 +++++-- module/icp/asm-arm/sha2/sha512-armv7.S | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/module/icp/asm-arm/sha2/sha256-armv7.S b/module/icp/asm-arm/sha2/sha256-armv7.S index 0001e4d690..0d36315873 100644 --- a/module/icp/asm-arm/sha2/sha256-armv7.S +++ b/module/icp/asm-arm/sha2/sha256-armv7.S @@ -21,8 +21,11 @@ #if defined(__arm__) -#define __ARM_ARCH__ 7 -#define __ARM_MAX_ARCH__ 7 +#ifndef __ARM_ARCH +# define __ARM_ARCH__ 7 +#else +# define __ARM_ARCH__ __ARM_ARCH +#endif #if defined(__thumb2__) .syntax unified diff --git a/module/icp/asm-arm/sha2/sha512-armv7.S b/module/icp/asm-arm/sha2/sha512-armv7.S index a4c804033b..499cb6df95 100644 --- a/module/icp/asm-arm/sha2/sha512-armv7.S +++ b/module/icp/asm-arm/sha2/sha512-armv7.S @@ -21,8 +21,11 @@ #if defined(__arm__) -#define __ARM_ARCH__ 7 -#define __ARM_MAX_ARCH__ 7 +#ifndef __ARM_ARCH +# define __ARM_ARCH__ 7 +#else +# define __ARM_ARCH__ __ARM_ARCH +#endif #ifndef __KERNEL__ # define VFP_ABI_PUSH vstmdb sp!,{d8-d15}