Hello,

On 21/09/2025 00:30, Sam James wrote:
Jussi Kivilinna <jussi.kivili...@iki.fi> writes:

* configure.ac (gcry_cv_riscv_vsha2cl_intrinsics_work)
(gcry_cv_riscv_vaes_vs_intrinsics_work): Run check with '-fno-lto' compiler
flag.


I assume this is because of https://gcc.gnu.org/PR110812? If so, a
comment referencing it would be nice.


Issue is with compiling with LTO is not generating target architecture (RISCV) instructions in 
output. This applies to both GCC and clang, and is not really a compiler bug but problem with these 
checks. Result was that 'configure' did not detect broken vsha2cl/vaes intrinsics when LTO was 
enabled for compiler. I'll change "target instructions" in comment to "RISCV 
instructions in compiler output" to clarify.

That GCC issue is for linker not knowing correct RISCV microarchitecture during 
linking for LTO, so different issue. I did notice that GCC could not build 
RISCV libgcrypt with LTO and errors I got looked the same as in that bug 
report. Clang LTO build did work... but with following warning during linking 
phase:

  Hard-float 'd' ABI can't be used for a target that doesn't support the D 
instruction set extension (ignoring target-abi)

-Jussi

--

Signed-off-by: Jussi Kivilinna <jussi.kivili...@iki.fi>
---
  configure.ac | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/configure.ac b/configure.ac
index 80d38496..90c513be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2934,6 +2934,9 @@ if test "$gcry_cv_cc_riscv_vector_crypto_intrinsics" = 
"yes" ||
      CFLAGS="$CFLAGS -O2 -march=$MARCH_RVA23U64_WITH_VEC_CRYPTO -mstrict-align"
    fi
+ # Disable LTO optimization to generate target instructions
+  CFLAGS="$CFLAGS -fno-lto"
+
    AC_CACHE_CHECK([whether compiler has working RISC-V __riscv_vsha2cl 
intrinsics],
      [gcry_cv_riscv_vsha2cl_intrinsics_work],
      [gcry_cv_riscv_vsha2cl_intrinsics_work=no
@@ -2981,6 +2984,9 @@ if test "$gcry_cv_cc_riscv_vector_crypto_intrinsics" = 
"yes" ||
      CFLAGS="$CFLAGS -O2"
    fi
+ # Disable LTO optimization to generate target instructions
+  CFLAGS="$CFLAGS -fno-lto"
+
    AC_CACHE_CHECK([whether compiler has working RISC-V __riscv_vaes*_vs 
intrinsics],
      [gcry_cv_riscv_vaes_vs_intrinsics_work],
      [gcry_cv_riscv_vaes_vs_intrinsics_work=no


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
https://lists.gnupg.org/mailman/listinfo/gcrypt-devel

Reply via email to