From 59ec002891a31f0b1c0f8874473719bc0a7ded41 Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Mon, 13 Sep 2021 18:42:29 +0100 Subject: [PATCH] Work around bad code generation with clang at -O2 Versions of clang from around 12 seem to generate code badly in mpi_mul_hlp(), causing the mpi tests to fail. Setting __attribute__ ((noinline)) fixes this issue. Signed-off-by: David Horstmann --- library/bignum.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/bignum.c b/library/bignum.c index 42ec7ac3141d..b81876d4cc9d 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -1635,10 +1635,10 @@ int mbedtls_mpi_sub_int( mbedtls_mpi *X, const mbedtls_mpi *A, mbedtls_mpi_sint * \param b A scalar to multiply. */ static -#if defined(__APPLE__) && defined(__arm__) +#if defined(__clang__) /* - * Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn) - * appears to need this to prevent bad ARM code generation at -O3. + * This is required to prevent bad code generation with various + * versions of clang at -O2 and -O3. */ __attribute__ ((noinline)) #endif