tests: build the SHA-512 crypto extensions with GCC and a fortified libc

Build sha512.c with -mcpu=cortex-a76 and _FORTIFY_SOURCE for both
MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY and _IF_PRESENT, which failed to
inline the fortified memset() before the previous commit. This needs
GCC 13 or later.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
This commit is contained in:
Julius Bairaktaris 2026-10-06 00:03:56 +02:00
parent 4d193a10f4
commit f1d54598a3

View File

@ -289,6 +289,20 @@ component_build_sha_armce_gcc () {
grep -E 'sha256[a-z0-9]+\s+[qv]' library/sha256.s
scripts/config.py unset $opt
done
# The same for the SHA-512 extensions with -mcpu=cortex-a76, which has
# extensions beyond Armv8.2-A. Before GCC 13, the SHA-512 intrinsics
# require Armv8.2-A, so this only builds with GCC 13 or later.
if [ "$(gcc_version "${AARCH64_LINUX_GNU_GCC_PREFIX}gcc")" -ge 13 ]; then
for opt in MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT; do
scripts/config.py set $opt
msg "$opt ${AARCH64_LINUX_GNU_GCC_PREFIX}gcc, -mcpu=cortex-a76 -D_FORTIFY_SOURCE=2"
make -B library/sha512.o library/sha512.s CC="${AARCH64_LINUX_GNU_GCC_PREFIX}gcc" CFLAGS="-std=c99 -Werror -O2 -mcpu=cortex-a76 -D_FORTIFY_SOURCE=2"
msg "$opt ${AARCH64_LINUX_GNU_GCC_PREFIX}gcc, test aarch64 crypto instructions built"
grep -E 'sha512[a-z0-9]+\s+[qv]' library/sha512.s
scripts/config.py unset $opt
done
fi
}
support_build_sha_armce_gcc () {