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