aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2024-05-28 09:04:24 +0200
committerFlorian Weimer <fweimer@redhat.com>2024-05-28 09:12:57 +0200
commit815c04826929e41e350f9e1f8e0d297725d14064 (patch)
tree49ef7c8246fa704f6a728c14204f90151fc81f64
parent0c1d2c277a59f08fd3232b33d18644ea890190ea (diff)
downloadglibc-815c04826929e41e350f9e1f8e0d297725d14064.zip
glibc-815c04826929e41e350f9e1f8e0d297725d14064.tar.gz
glibc-815c04826929e41e350f9e1f8e0d297725d14064.tar.bz2
x86: Introduce _dl_x86_init_cpu_failure for startup failure reporting
-rw-r--r--sysdeps/x86/dl-get-cpu-features.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sysdeps/x86/dl-get-cpu-features.c b/sysdeps/x86/dl-get-cpu-features.c
index 579d02d..f36d42d 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) */
}