c5d972
commit 5ecc98241229d494aaad23a4a3fe106fe11e1f40
c5d972
Author: Florian Weimer <fweimer@redhat.com>
c5d972
Date:   Thu Aug 25 16:34:20 2022 +0200
c5d972
c5d972
    s390: Move hwcaps/platform names out of _rtld_global_ro
c5d972
    
c5d972
    Changes to these arrays are often backported to stable releases,
c5d972
    but additions to these arrays shift the offsets of the following
c5d972
    _rltd_global_ro members, thus breaking the GLIBC_PRIVATE ABI.
c5d972
    
c5d972
    Obviously, this change is itself an internal ABI break, but at least
c5d972
    it will avoid further ABI breaks going forward.
c5d972
    
c5d972
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
c5d972
c5d972
Conflicts:
c5d972
	sysdeps/s390/Makefile
c5d972
	  (missing lazy binding test downstream)
c5d972
c5d972
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
c5d972
index 5c8e1170b4d799ba..ea453ba87646c95a 100644
c5d972
--- a/sysdeps/s390/Makefile
c5d972
+++ b/sysdeps/s390/Makefile
c5d972
@@ -42,6 +42,10 @@ $(modpfx)gconv-modules-s390.conf: ../sysdeps/s390/gconv-modules-s390.conf \
c5d972
 	cp $< $@
c5d972
 endif
c5d972
 
c5d972
+ifeq ($(subdir),elf)
c5d972
+sysdep-dl-routines += dl-procinfo-s390
c5d972
+endif
c5d972
+
c5d972
 ifeq ($(subdir),string)
c5d972
 sysdep_routines += bzero memset memset-z900 \
c5d972
 		   memcmp memcmp-z900 \
c5d972
diff --git a/sysdeps/s390/dl-procinfo-s390.c b/sysdeps/s390/dl-procinfo-s390.c
c5d972
new file mode 100644
c5d972
index 0000000000000000..559f3827936cd017
c5d972
--- /dev/null
c5d972
+++ b/sysdeps/s390/dl-procinfo-s390.c
c5d972
@@ -0,0 +1,32 @@
c5d972
+/* Data for s390 version of processor capability information.
c5d972
+   Copyright (C) 2006-2022 Free Software Foundation, Inc.
c5d972
+   This file is part of the GNU C Library.
c5d972
+
c5d972
+   The GNU C Library is free software; you can redistribute it and/or
c5d972
+   modify it under the terms of the GNU Lesser General Public
c5d972
+   License as published by the Free Software Foundation; either
c5d972
+   version 2.1 of the License, or (at your option) any later version.
c5d972
+
c5d972
+   The GNU C Library is distributed in the hope that it will be useful,
c5d972
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
c5d972
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
c5d972
+   Lesser General Public License for more details.
c5d972
+
c5d972
+   You should have received a copy of the GNU Lesser General Public
c5d972
+   License along with the GNU C Library; if not, see
c5d972
+   <https://www.gnu.org/licenses/>.  */
c5d972
+
c5d972
+#include <dl-procinfo.h>
c5d972
+
c5d972
+const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] =
c5d972
+  {
c5d972
+    "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp", "edat", "etf3eh",
c5d972
+    "highgprs", "te", "vx", "vxd", "vxe", "gs", "vxe2", "vxp", "sort", "dflt",
c5d972
+    "vxp2", "nnpa", "pcimio", "sie"
c5d972
+  };
c5d972
+
c5d972
+const char _dl_s390_platforms[_DL_PLATFORMS_COUNT][7] =
c5d972
+  {
c5d972
+    "g5", "z900", "z990", "z9-109", "z10", "z196", "zEC12", "z13", "z14", "z15",
c5d972
+    "z16"
c5d972
+  };
c5d972
diff --git a/sysdeps/s390/dl-procinfo.c b/sysdeps/s390/dl-procinfo.c
c5d972
index 85108943d0e79f29..f928b485609a3b8a 100644
c5d972
--- a/sysdeps/s390/dl-procinfo.c
c5d972
+++ b/sysdeps/s390/dl-procinfo.c
c5d972
@@ -17,66 +17,10 @@
c5d972
    License along with the GNU C Library; if not, see
c5d972
    <http://www.gnu.org/licenses/>.  */
c5d972
 
c5d972
-/* This information must be kept in sync with the _DL_HWCAP_COUNT and
c5d972
-   _DL_PLATFORM_COUNT definitions in procinfo.h.
c5d972
-
c5d972
-   If anything should be added here check whether the size of each string
c5d972
-   is still ok with the given array size.
c5d972
-
c5d972
-   All the #ifdefs in the definitions are quite irritating but
c5d972
-   necessary if we want to avoid duplicating the information.  There
c5d972
-   are three different modes:
c5d972
-
c5d972
-   - PROCINFO_DECL is defined.  This means we are only interested in
c5d972
-     declarations.
c5d972
-
c5d972
-   - PROCINFO_DECL is not defined:
c5d972
-
c5d972
-     + if SHARED is defined the file is included in an array
c5d972
-       initializer.  The .element = { ... } syntax is needed.
c5d972
-
c5d972
-     + if SHARED is not defined a normal array initialization is
c5d972
-       needed.
c5d972
-  */
c5d972
-
c5d972
-#ifndef PROCINFO_CLASS
c5d972
-# define PROCINFO_CLASS
c5d972
-#endif
c5d972
-
c5d972
-#if !defined PROCINFO_DECL && defined SHARED
c5d972
-  ._dl_s390_cap_flags
c5d972
-#else
c5d972
-PROCINFO_CLASS const char _dl_s390_cap_flags[23][9]
c5d972
-#endif
c5d972
-#ifndef PROCINFO_DECL
c5d972
-= {
c5d972
-     "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp", "edat", "etf3eh",
c5d972
-     "highgprs", "te", "vx", "vxd", "vxe", "gs", "vxe2", "vxp", "sort", "dflt",
c5d972
-     "vxp2", "nnpa", "pcimio", "sie"
c5d972
-  }
c5d972
-#endif
c5d972
-#if !defined SHARED || defined PROCINFO_DECL
c5d972
-;
c5d972
-#else
c5d972
-,
c5d972
-#endif
c5d972
-
c5d972
-#if !defined PROCINFO_DECL && defined SHARED
c5d972
-  ._dl_s390_platforms
c5d972
-#else
c5d972
-PROCINFO_CLASS const char _dl_s390_platforms[11][7]
c5d972
-#endif
c5d972
-#ifndef PROCINFO_DECL
c5d972
-= {
c5d972
-    "g5", "z900", "z990", "z9-109", "z10", "z196", "zEC12", "z13", "z14", "z15",
c5d972
-    "z16"
c5d972
-  }
c5d972
-#endif
c5d972
-#if !defined SHARED || defined PROCINFO_DECL
c5d972
-;
c5d972
-#else
c5d972
-,
c5d972
-#endif
c5d972
+/* The hwcap and platform strings are now in
c5d972
+   sysdeps/s390/dl-procinfo-s390.c.  */
c5d972
 
c5d972
+/* Needed by sysdeps/unix/sysv/linux/dl-vdso-setup.c (as included from
c5d972
+   sysdeps/generic/ldsodefs.h).  */
c5d972
 #undef PROCINFO_DECL
c5d972
 #undef PROCINFO_CLASS
c5d972
diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
c5d972
index f2b2c9ac1bb7239b..5eb2c0a39fcff520 100644
c5d972
--- a/sysdeps/s390/dl-procinfo.h
c5d972
+++ b/sysdeps/s390/dl-procinfo.h
c5d972
@@ -22,8 +22,10 @@
c5d972
 #include <ldsodefs.h>
c5d972
 
c5d972
 #define _DL_HWCAP_COUNT 23
c5d972
+extern const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] attribute_hidden;
c5d972
 
c5d972
 #define _DL_PLATFORMS_COUNT	11
c5d972
+extern const char _dl_s390_platforms[_DL_PLATFORMS_COUNT][7] attribute_hidden;
c5d972
 
c5d972
 /* The kernel provides up to 32 capability bits with elf_hwcap.  */
c5d972
 #define _DL_FIRST_PLATFORM	32
c5d972
@@ -79,7 +81,7 @@ static inline const char *
c5d972
 __attribute__ ((unused))
c5d972
 _dl_hwcap_string (int idx)
c5d972
 {
c5d972
-  return GLRO(dl_s390_cap_flags)[idx];
c5d972
+  return _dl_s390_cap_flags[idx];
c5d972
 };
c5d972
 
c5d972
 static inline int
c5d972
@@ -90,7 +92,7 @@ _dl_string_hwcap (const char *str)
c5d972
 
c5d972
   for (i = 0; i < _DL_HWCAP_COUNT; i++)
c5d972
     {
c5d972
-      if (strcmp (str, GLRO(dl_s390_cap_flags)[i]) == 0)
c5d972
+      if (strcmp (str, _dl_s390_cap_flags[i]) == 0)
c5d972
 	return i;
c5d972
     }
c5d972
   return -1;
c5d972
@@ -105,7 +107,7 @@ _dl_string_platform (const char *str)
c5d972
   if (str != NULL)
c5d972
     for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
c5d972
       {
c5d972
-	if (strcmp (str, GLRO(dl_s390_platforms)[i]) == 0)
c5d972
+	if (strcmp (str, _dl_s390_platforms[i]) == 0)
c5d972
 	  return _DL_FIRST_PLATFORM + i;
c5d972
       }
c5d972
   return -1;
c5d972
diff --git a/sysdeps/unix/sysv/linux/s390/dl-procinfo.h b/sysdeps/unix/sysv/linux/s390/dl-procinfo.h
c5d972
index d1516a05e3042163..4aefd7eef14eaf52 100644
c5d972
--- a/sysdeps/unix/sysv/linux/s390/dl-procinfo.h
c5d972
+++ b/sysdeps/unix/sysv/linux/s390/dl-procinfo.h
c5d972
@@ -40,7 +40,7 @@ _dl_procinfo (unsigned int type, unsigned long int word)
c5d972
 
c5d972
   for (i = 0; i < _DL_HWCAP_COUNT; ++i)
c5d972
     if (word & (1UL << i))
c5d972
-      _dl_printf (" %s", GLRO(dl_s390_cap_flags)[i]);
c5d972
+      _dl_printf (" %s", _dl_s390_cap_flags[i]);
c5d972
 
c5d972
   _dl_printf ("\n");
c5d972