From 652598096325c2478d7d033585dadc13bec6fb1d Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Thu, 2 Mar 2023 11:48:15 +0200 Subject: chacha20-ppc: do not generate p9 code when target attr unavailable * cipher/chacha20-ppc.c (HAVE_FUNC_ATTR_TARGET): New. (_gcry_chacha20_ppc9_blocks1, _gcry_chacha20_ppc9_blocks4) (_gcry_chacha20_poly1305_ppc8_blocks4): Use inline functions only if HAVE_FUNC_ATTR_TARGET is defined. -- Signed-off-by: Jussi Kivilinna --- cipher/chacha20-ppc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cipher') diff --git a/cipher/chacha20-ppc.c b/cipher/chacha20-ppc.c index f135a32f..994b6a01 100644 --- a/cipher/chacha20-ppc.c +++ b/cipher/chacha20-ppc.c @@ -660,12 +660,15 @@ chacha20_poly1305_ppc_blocks4(u32 *state, byte *dst, const byte *src, #if defined(__clang__) && defined(HAVE_CLANG_ATTRIBUTE_PPC_TARGET) # define FUNC_ATTR_TARGET_P8 __attribute__((target("arch=pwr8"))) # define FUNC_ATTR_TARGET_P9 __attribute__((target("arch=pwr9"))) +# define HAVE_FUNC_ATTR_TARGET 1 #elif defined(HAVE_GCC_ATTRIBUTE_PPC_TARGET) # define FUNC_ATTR_TARGET_P8 __attribute__((target("cpu=power8"))) # define FUNC_ATTR_TARGET_P9 __attribute__((target("cpu=power9"))) +# define HAVE_FUNC_ATTR_TARGET 1 #else # define FUNC_ATTR_TARGET_P8 # define FUNC_ATTR_TARGET_P9 +# undef HAVE_FUNC_ATTR_TARGET #endif @@ -693,7 +696,7 @@ _gcry_chacha20_poly1305_ppc8_blocks4(u32 *state, byte *dst, const byte *src, poly1305_src); } -#ifdef HAVE_GCC_ATTRIBUTE_PPC_TARGET +#ifdef HAVE_FUNC_ATTR_TARGET /* Functions targetting POWER9. */ unsigned int ASM_FUNC_ATTR FUNC_ATTR_TARGET_P9 FUNC_ATTR_OPT_O2 _gcry_chacha20_ppc9_blocks1(u32 *state, byte *dst, const byte *src, -- cgit v1.2.1