From 66bae697a853b21e0a2ff2a5031d23e3691a9084 Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Wed, 1 Mar 2023 11:22:49 +0200 Subject: Improve PPC target function attribute checks * configure.ac (gcry_cv_gcc_attribute_ppc_target) (gcry_cv_clang_attribute_ppc_target): Add 'always_inline' function to test. -- With some CFLAG combinations, target attribute fails to work with always_inline functions. Patch adds detection for such configuration and disables target attribute use in such case (and suffer less optimal code generation). Signed-off-by: Jussi Kivilinna --- configure.ac | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 0d5c9160..44340e49 100644 --- a/configure.ac +++ b/configure.ac @@ -2376,10 +2376,11 @@ AC_CACHE_CHECK([whether compiler supports GCC PowerPC target attributes], else gcry_cv_gcc_attribute_ppc_target=no AC_LINK_IFELSE([AC_LANG_PROGRAM( - [[void __attribute__((target("cpu=power8"))) testfn8(void) {} + [[void __attribute__((always_inline)) inline aifn(void) {} + void __attribute__((target("cpu=power8"))) testfn8(void) {aifn();} void __attribute__((target("cpu=power9"))) testfn9(void) - { testfn8(); } - ]], [ testfn9(); ])], + { testfn8(); aifn(); } + ]], [ testfn9(); aifn(); ])], [gcry_cv_gcc_attribute_ppc_target=yes]) fi]) if test "$gcry_cv_gcc_attribute_ppc_target" = "yes" ; then @@ -2398,10 +2399,11 @@ AC_CACHE_CHECK([whether compiler supports clang PowerPC target attributes], else gcry_cv_clang_attribute_ppc_target=no AC_LINK_IFELSE([AC_LANG_PROGRAM( - [[void __attribute__((target("arch=pwr8"))) testfn8(void) {} + [[void __attribute__((always_inline)) inline aifn(void) {} + void __attribute__((target("arch=pwr8"))) testfn8(void) {aifn();} void __attribute__((target("arch=pwr9"))) testfn9(void) - { testfn8(); } - ]], [ testfn9(); ])], + { testfn8(); aifn(); } + ]], [ testfn9(); aifn(); ])], [gcry_cv_clang_attribute_ppc_target=yes]) fi]) if test "$gcry_cv_clang_attribute_ppc_target" = "yes" ; then -- cgit v1.2.1