public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/gcs-13)] libgcc: aarch64: Configure check for __getauxval
@ 2024-02-14 15:35 Szabolcs Nagy
  0 siblings, 0 replies; only message in thread
From: Szabolcs Nagy @ 2024-02-14 15:35 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6fccf322242d568a069f81622cf7cccacd62ecb8

commit 6fccf322242d568a069f81622cf7cccacd62ecb8
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Mon Dec 4 10:52:52 2023 +0000

    libgcc: aarch64: Configure check for __getauxval
    
    Add configure check for the __getauxval ABI symbol, which is always
    available on aarch64 glibc, and may be available on other linux C
    runtimes. For now only enabled on glibc, others have to override it
    
      target_configargs=libgcc_cv_have___getauxval=yes
    
    This is deliberately obscure as it should be auto detected, ideally
    via a feature test macro in unistd.h (link time detection is not
    possible since the libc may not be installed at libgcc build time),
    but currently there is no such feature test mechanism.
    
    Without __getauxval, libgcc cannot do runtime CPU feature detection
    and has to assume only the build time known features are available.
    
    libgcc/ChangeLog:
    
            * config.in: Undef HAVE___GETAUXVAL.
            * configure: Regenerate.
            * configure.ac: Check for __getauxval.
    
    (cherry picked from commit dbbfb52b0e9c66ee9d05b8fd17c4f44655e48463)

Diff:
---
 libgcc/config.in    |  3 +++
 libgcc/configure    | 26 ++++++++++++++++++++++++++
 libgcc/configure.ac | 19 +++++++++++++++++++
 3 files changed, 48 insertions(+)

diff --git a/libgcc/config.in b/libgcc/config.in
index 5dd96cdf648c..441d4d39b95b 100644
--- a/libgcc/config.in
+++ b/libgcc/config.in
@@ -16,6 +16,9 @@
 /* Define to 1 if the assembler supports .variant_pcs. */
 #undef HAVE_AS_VARIANT_PCS
 
+/* Define to 1 if __getauxval is available. */
+#undef HAVE___GETAUXVAL
+
 /* Define to 1 if the target assembler supports thread-local storage. */
 #undef HAVE_CC_TLS
 
diff --git a/libgcc/configure b/libgcc/configure
index 537fa9836e1f..790c3e9da983 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5659,6 +5659,32 @@ $as_echo "#define HAVE_AS_VARIANT_PCS 1" >>confdefs.h
   ;;
 esac
 
+# Check __getauxval ABI symbol for CPU feature detection.
+case ${target} in
+aarch64*-linux-*)
+  # No link check because the libc may not be present.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __getauxval" >&5
+$as_echo_n "checking for __getauxval... " >&6; }
+if ${libgcc_cv_have___getauxval+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case ${target} in
+		  *-linux-gnu*)
+		    libgcc_cv_have___getauxval=yes
+		    ;;
+		  *)
+		    libgcc_cv_have___getauxval=no
+		  esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_have___getauxval" >&5
+$as_echo "$libgcc_cv_have___getauxval" >&6; }
+  if test x$libgcc_cv_have___getauxval = xyes; then
+
+$as_echo "#define HAVE___GETAUXVAL 1" >>confdefs.h
+
+  fi
+esac
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for init priority support" >&5
 $as_echo_n "checking for init priority support... " >&6; }
 if ${libgcc_cv_init_priority+:} false; then :
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index abc398c91e40..64b45ae1423f 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -665,6 +665,25 @@ aarch64*-*-*)
 esac])
 LIBGCC_CHECK_AS_VARIANT_PCS
 
+# Check __getauxval ABI symbol for CPU feature detection.
+case ${target} in
+aarch64*-linux-*)
+  # No link check because the libc may not be present.
+  AC_CACHE_CHECK([for __getauxval],
+		 [libgcc_cv_have___getauxval],
+		 [case ${target} in
+		  *-linux-gnu*)
+		    libgcc_cv_have___getauxval=yes
+		    ;;
+		  *)
+		    libgcc_cv_have___getauxval=no
+		  esac])
+  if test x$libgcc_cv_have___getauxval = xyes; then
+    AC_DEFINE(HAVE___GETAUXVAL, 1,
+	      [Define to 1 if __getauxval is available.])
+  fi
+esac
+
 dnl Check if as supports RTM instructions.
 AC_CACHE_CHECK(for init priority support, libgcc_cv_init_priority, [
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-14 15:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-14 15:35 [gcc(refs/vendors/ARM/heads/gcs-13)] libgcc: aarch64: Configure check for __getauxval Szabolcs Nagy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).