public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/fw/x86-diagnostics] x86: Introduce _dl_x86_init_cpu_failure for startup failure reporting
@ 2024-06-07 14:44 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2024-06-07 14:44 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=815c04826929e41e350f9e1f8e0d297725d14064

commit 815c04826929e41e350f9e1f8e0d297725d14064
Author: Florian Weimer <fweimer@redhat.com>
Date:   Tue May 28 09:04:24 2024 +0200

    x86: Introduce _dl_x86_init_cpu_failure for startup failure reporting

Diff:
---
 sysdeps/x86/dl-get-cpu-features.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/sysdeps/x86/dl-get-cpu-features.c b/sysdeps/x86/dl-get-cpu-features.c
index 579d02d638..f36d42d6af 100644
--- a/sysdeps/x86/dl-get-cpu-features.c
+++ b/sysdeps/x86/dl-get-cpu-features.c
@@ -32,6 +32,17 @@ extern void __x86_cpu_features (void) attribute_hidden;
 void (*const __x86_cpu_features_p) (void) attribute_hidden
   = __x86_cpu_features;
 
+_Noreturn static void __attribute__ ((unused))
+_dl_x86_init_cpu_failure (const struct cpu_features *cpu_features, int level)
+{
+  if (level == 5)
+    _dl_fatal_printf ("\
+Fatal glibc error: CPU does not support APX\n");
+  else
+    _dl_fatal_printf ("\
+Fatal glibc error: CPU does not support x86-64-v%d\n", level);
+}
+
 void
 _dl_x86_init_cpu_features (void)
 {
@@ -47,27 +58,23 @@ _dl_x86_init_cpu_features (void)
   && defined GCCMACRO__SSE3__ && defined GCCMACRO__SSSE3__		\
   && defined GCCMACRO__SSE4_1__ && defined GCCMACRO__SSE4_2__
       if (!(cpu_features->isa_1 & GNU_PROPERTY_X86_ISA_1_V2))
-	_dl_fatal_printf ("\
-Fatal glibc error: CPU does not support x86-64-v%d\n", 2);
+	_dl_x86_init_cpu_failure (cpu_features, 2);
 #   if defined GCCMACRO__AVX__ && defined GCCMACRO__AVX2__ \
   && defined GCCMACRO__F16C__ && defined GCCMACRO__FMA__   \
   && defined GCCMACRO__LZCNT__ && defined HAVE_X86_MOVBE
       if (!(cpu_features->isa_1 & GNU_PROPERTY_X86_ISA_1_V3))
-	_dl_fatal_printf ("\
-Fatal glibc error: CPU does not support x86-64-v%d\n", 3);
+	_dl_x86_init_cpu_failure (cpu_features, 3);
 #    if defined GCCMACRO__AVX512F__ && defined GCCMACRO__AVX512BW__ \
      && defined GCCMACRO__AVX512CD__ && defined GCCMACRO__AVX512DQ__ \
      && defined GCCMACRO__AVX512VL__
       if (!(cpu_features->isa_1 & GNU_PROPERTY_X86_ISA_1_V4))
-	_dl_fatal_printf ("\
-Fatal glibc error: CPU does not support x86-64-v%d\n", 4);
+	_dl_x86_init_cpu_failure (cpu_features, 4);
 #    endif /* ISA level 4 */
 #   endif /* ISA level 3 */
 #  endif /* ISA level 2 */
 # ifdef GCCMACRO__APX_F__
       if (!CPU_FEATURE_USABLE_P (cpu_features, APX_F))
-	_dl_fatal_printf ("\
-Fatal glibc error: CPU does not support APX\n");
+	_dl_x86_init_cpu_failure (cpu_features, 5);
 # endif
 # endif /* IS_IN (rtld) */
     }

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

only message in thread, other threads:[~2024-06-07 14:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-07 14:44 [glibc/fw/x86-diagnostics] x86: Introduce _dl_x86_init_cpu_failure for startup failure reporting Florian Weimer

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).