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