public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] s390: Move hwcaps/platform names out of _rtld_global_ro
@ 2022-08-25 19:34 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2022-08-25 19:34 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5ecc98241229d494aaad23a4a3fe106fe11e1f40

commit 5ecc98241229d494aaad23a4a3fe106fe11e1f40
Author: Florian Weimer <fweimer@redhat.com>
Date:   Thu Aug 25 16:34:20 2022 +0200

    s390: Move hwcaps/platform names out of _rtld_global_ro
    
    Changes to these arrays are often backported to stable releases,
    but additions to these arrays shift the offsets of the following
    _rltd_global_ro members, thus breaking the GLIBC_PRIVATE ABI.
    
    Obviously, this change is itself an internal ABI break, but at least
    it will avoid further ABI breaks going forward.
    
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>

Diff:
---
 sysdeps/s390/Makefile                      |  2 +
 sysdeps/s390/dl-procinfo-s390.c            | 32 +++++++++++++++
 sysdeps/s390/dl-procinfo.c                 | 64 ++----------------------------
 sysdeps/s390/dl-procinfo.h                 |  8 ++--
 sysdeps/unix/sysv/linux/s390/dl-procinfo.h |  2 +-
 5 files changed, 44 insertions(+), 64 deletions(-)

diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
index 5b6a96579c..1d687a2184 100644
--- a/sysdeps/s390/Makefile
+++ b/sysdeps/s390/Makefile
@@ -43,6 +43,8 @@ $(modpfx)gconv-modules-s390.conf: ../sysdeps/s390/gconv-modules-s390.conf \
 endif
 
 ifeq ($(subdir),elf)
+sysdep-dl-routines += dl-procinfo-s390
+
 ifeq ($(build-shared),yes)
 tests += tst-dl-runtime-resolve-noaudit tst-dl-runtime-resolve-audit \
 	tst-dl-runtime-profile-noaudit
diff --git a/sysdeps/s390/dl-procinfo-s390.c b/sysdeps/s390/dl-procinfo-s390.c
new file mode 100644
index 0000000000..559f382793
--- /dev/null
+++ b/sysdeps/s390/dl-procinfo-s390.c
@@ -0,0 +1,32 @@
+/* Data for s390 version of processor capability information.
+   Copyright (C) 2006-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <dl-procinfo.h>
+
+const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] =
+  {
+    "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp", "edat", "etf3eh",
+    "highgprs", "te", "vx", "vxd", "vxe", "gs", "vxe2", "vxp", "sort", "dflt",
+    "vxp2", "nnpa", "pcimio", "sie"
+  };
+
+const char _dl_s390_platforms[_DL_PLATFORMS_COUNT][7] =
+  {
+    "g5", "z900", "z990", "z9-109", "z10", "z196", "zEC12", "z13", "z14", "z15",
+    "z16"
+  };
diff --git a/sysdeps/s390/dl-procinfo.c b/sysdeps/s390/dl-procinfo.c
index f142221a17..88c955c12b 100644
--- a/sysdeps/s390/dl-procinfo.c
+++ b/sysdeps/s390/dl-procinfo.c
@@ -16,66 +16,10 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* This information must be kept in sync with the _DL_HWCAP_COUNT and
-   _DL_PLATFORM_COUNT definitions in procinfo.h.
-
-   If anything should be added here check whether the size of each string
-   is still ok with the given array size.
-
-   All the #ifdefs in the definitions are quite irritating but
-   necessary if we want to avoid duplicating the information.  There
-   are three different modes:
-
-   - PROCINFO_DECL is defined.  This means we are only interested in
-     declarations.
-
-   - PROCINFO_DECL is not defined:
-
-     + if SHARED is defined the file is included in an array
-       initializer.  The .element = { ... } syntax is needed.
-
-     + if SHARED is not defined a normal array initialization is
-       needed.
-  */
-
-#ifndef PROCINFO_CLASS
-# define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_s390_cap_flags
-#else
-PROCINFO_CLASS const char _dl_s390_cap_flags[23][9]
-#endif
-#ifndef PROCINFO_DECL
-= {
-     "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp", "edat", "etf3eh",
-     "highgprs", "te", "vx", "vxd", "vxe", "gs", "vxe2", "vxp", "sort", "dflt",
-     "vxp2", "nnpa", "pcimio", "sie"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_s390_platforms
-#else
-PROCINFO_CLASS const char _dl_s390_platforms[11][7]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "g5", "z900", "z990", "z9-109", "z10", "z196", "zEC12", "z13", "z14", "z15",
-    "z16"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
+/* The hwcap and platform strings are now in
+   sysdeps/s390/dl-procinfo-s390.c.  */
 
+/* Needed by sysdeps/unix/sysv/linux/dl-vdso-setup.c (as included from
+   sysdeps/generic/ldsodefs.h).  */
 #undef PROCINFO_DECL
 #undef PROCINFO_CLASS
diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
index 1f4e3875ba..e1f88b9ab7 100644
--- a/sysdeps/s390/dl-procinfo.h
+++ b/sysdeps/s390/dl-procinfo.h
@@ -21,8 +21,10 @@
 #include <ldsodefs.h>
 
 #define _DL_HWCAP_COUNT 23
+extern const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] attribute_hidden;
 
 #define _DL_PLATFORMS_COUNT	11
+extern const char _dl_s390_platforms[_DL_PLATFORMS_COUNT][7] attribute_hidden;
 
 /* The kernel provides up to 32 capability bits with elf_hwcap.  */
 #define _DL_FIRST_PLATFORM	32
@@ -78,7 +80,7 @@ static inline const char *
 __attribute__ ((unused))
 _dl_hwcap_string (int idx)
 {
-  return GLRO(dl_s390_cap_flags)[idx];
+  return _dl_s390_cap_flags[idx];
 };
 
 static inline int
@@ -89,7 +91,7 @@ _dl_string_hwcap (const char *str)
 
   for (i = 0; i < _DL_HWCAP_COUNT; i++)
     {
-      if (strcmp (str, GLRO(dl_s390_cap_flags)[i]) == 0)
+      if (strcmp (str, _dl_s390_cap_flags[i]) == 0)
 	return i;
     }
   return -1;
@@ -104,7 +106,7 @@ _dl_string_platform (const char *str)
   if (str != NULL)
     for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
       {
-	if (strcmp (str, GLRO(dl_s390_platforms)[i]) == 0)
+	if (strcmp (str, _dl_s390_platforms[i]) == 0)
 	  return _DL_FIRST_PLATFORM + i;
       }
   return -1;
diff --git a/sysdeps/unix/sysv/linux/s390/dl-procinfo.h b/sysdeps/unix/sysv/linux/s390/dl-procinfo.h
index 46790c2103..a8e27149fd 100644
--- a/sysdeps/unix/sysv/linux/s390/dl-procinfo.h
+++ b/sysdeps/unix/sysv/linux/s390/dl-procinfo.h
@@ -39,7 +39,7 @@ _dl_procinfo (unsigned int type, unsigned long int word)
 
   for (i = 0; i < _DL_HWCAP_COUNT; ++i)
     if (word & (1UL << i))
-      _dl_printf (" %s", GLRO(dl_s390_cap_flags)[i]);
+      _dl_printf (" %s", _dl_s390_cap_flags[i]);
 
   _dl_printf ("\n");

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

only message in thread, other threads:[~2022-08-25 19:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25 19:34 [glibc] s390: Move hwcaps/platform names out of _rtld_global_ro 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).