public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* s390x: Diagnose missing VXE at run time if required at build time
@ 2021-04-06 15:55 Florian Weimer
  2021-04-08 14:49 ` Stefan Liebler
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Weimer @ 2021-04-06 15:55 UTC (permalink / raw)
  To: libc-alpha; +Cc: Stefan Liebler

It turns out that if glibc is built with -march=z14, it is still
possible to run up to dl_platform_init on z13 CPUs.  This means we can
add a diagnostic to glibc, notifying the user that the CPU is too old.

The check is based on the way GCC sets the __LONG_DOUBLE_VX__
preprocessor macro:

  s390_def_or_undef_macro (
      pfile,
      [] (const struct cl_target_option *opts) { return TARGET_VXE_P (opts); },
      old_opts, opts, "__LONG_DOUBLE_VX__", "__LONG_DOUBLE_VX__");


diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h
index 543361c83637c071..deaf37951206fb7c 100644
--- a/sysdeps/s390/s390-64/dl-machine.h
+++ b/sysdeps/s390/s390-64/dl-machine.h
@@ -235,6 +235,12 @@ _dl_start_user:\n\
 static inline void __attribute__ ((unused))
 dl_platform_init (void)
 {
+#ifdef __LONG_DOUBLE_VX__
+  if (!(GLRO(dl_hwcap) & HWCAP_S390_VXE))
+    _dl_fatal_printf ("\
+Fatal glibc error: CPU lacks VXE support (z14 or later required)\n");
+#endif
+
   if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0')
     /* Avoid an empty string which would disturb us.  */
     GLRO(dl_platform) = NULL;


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-09 13:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 15:55 s390x: Diagnose missing VXE at run time if required at build time Florian Weimer
2021-04-08 14:49 ` Stefan Liebler
2021-04-08 15:30   ` Florian Weimer
2021-04-09  8:35     ` Florian Weimer
2021-04-09 13:50     ` Stefan Liebler

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