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