about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2024-03-13 14:34:14 +0000
committerWilco Dijkstra <wilco.dijkstra@arm.com>2024-04-08 17:34:08 +0100
commit7f3c1433815c4c00755a1b7c2f015d18196c6c0e (patch)
tree2e2d1467f142c11c6e3e85918baf70a2ef235f3b
parent9112cda4c62e8a410be775045d5d307ebb48f0fe (diff)
downloadglibc-7f3c1433815c4c00755a1b7c2f015d18196c6c0e.tar.gz
glibc-7f3c1433815c4c00755a1b7c2f015d18196c6c0e.tar.xz
glibc-7f3c1433815c4c00755a1b7c2f015d18196c6c0e.zip
aarch64: fix check for SVE support in assembler
Due to GCC bug 110901 -mcpu can override -march setting when compiling
asm code and thus a compiler targetting a specific cpu can fail the
configure check even when binutils gas supports SVE.

The workaround is that explicit .arch directive overrides both -mcpu
and -march, and since that's what the actual SVE memcpy uses the
configure check should use that too even if the GCC issue is fixed
independently.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
(cherry picked from commit 73c26018ed0ecd9c807bb363cc2c2ab4aca66a82)
-rwxr-xr-x[-rw-r--r--]sysdeps/aarch64/configure5
-rw-r--r--sysdeps/aarch64/configure.ac5
2 files changed, 6 insertions, 4 deletions
diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
index 276a2d1dc4..af47ca78f3 100644..100755
--- a/sysdeps/aarch64/configure
+++ b/sysdeps/aarch64/configure
@@ -312,9 +312,10 @@ if ${libc_cv_aarch64_sve_asm+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat > conftest.s <<\EOF
-        ptrue p0.b
+	.arch armv8.2-a+sve
+	ptrue p0.b
 EOF
-if { ac_try='${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&5'
+if { ac_try='${CC-cc} -c conftest.s 1>&5'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
index 6afe178823..186e1007ea 100644
--- a/sysdeps/aarch64/configure.ac
+++ b/sysdeps/aarch64/configure.ac
@@ -94,9 +94,10 @@ LIBC_CONFIG_VAR([aarch64-variant-pcs], [$libc_cv_aarch64_variant_pcs])
 # Check if asm support armv8.2-a+sve
 AC_CACHE_CHECK([for SVE support in assembler], [libc_cv_aarch64_sve_asm], [dnl
 cat > conftest.s <<\EOF
-        ptrue p0.b
+	.arch armv8.2-a+sve
+	ptrue p0.b
 EOF
-if AC_TRY_COMMAND(${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&AS_MESSAGE_LOG_FD); then
+if AC_TRY_COMMAND(${CC-cc} -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
   libc_cv_aarch64_sve_asm=yes
 else
   libc_cv_aarch64_sve_asm=no