c5d972
commit 2376944b9e5c0364b9fb473e4d8dabca31b57167
c5d972
Author: Stefan Liebler <stli@linux.ibm.com>
c5d972
Date:   Wed Apr 13 14:36:09 2022 +0200
c5d972
c5d972
    S390: Add new s390 platform z16.
c5d972
c5d972
    The new IBM z16 is added to platform string array.
c5d972
    The macro _DL_PLATFORMS_COUNT is incremented.
c5d972
c5d972
    _dl_hwcaps_subdir is extended by "z16" if HWCAP_S390_VXRS_PDE2
c5d972
    is set. HWCAP_S390_NNPA is not tested in _dl_hwcaps_subdirs_active
c5d972
    as those instructions may be replaced or removed in future.
c5d972
c5d972
    tst-glibc-hwcaps.c is extended in order to test z16 via new marker5.
c5d972
c5d972
    A fatal glibc error is dumped if glibc was build with architecture
c5d972
    level set for z16, but run on an older machine. (See dl-hwcap-check.h)
c5d972
c5d972
Reworked for RHEL 8.7.0
c5d972
c5d972
diff -Nrup a/elf/Makefile b/elf/Makefile
c5d972
--- a/elf/Makefile	2022-05-16 21:48:11.267916411 -0400
c5d972
+++ b/elf/Makefile	2022-05-16 21:48:56.106095151 -0400
c5d972
@@ -347,7 +347,8 @@ modules-names = testobj1 testobj2 testob
c5d972
 		libmarkermod2-1 libmarkermod2-2 \
c5d972
 		libmarkermod3-1 libmarkermod3-2 libmarkermod3-3 \
c5d972
 		libmarkermod4-1 libmarkermod4-2 libmarkermod4-3 libmarkermod4-4 \
c5d972
-		tst-tls20mod-bad tst-tls21mod \
c5d972
+		libmarkermod5-1 libmarkermod5-2 libmarkermod5-3 libmarkermod5-4 \
c5d972
+		libmarkermod5-5 tst-tls20mod-bad tst-tls21mod \
c5d972
 
c5d972
 # Most modules build with _ISOMAC defined, but those filtered out
c5d972
 # depend on internal headers.
c5d972
@@ -1782,6 +1783,7 @@ LDFLAGS-libmarkermod1-1.so += -Wl,-sonam
c5d972
 LDFLAGS-libmarkermod2-1.so += -Wl,-soname,libmarkermod2.so
c5d972
 LDFLAGS-libmarkermod3-1.so += -Wl,-soname,libmarkermod3.so
c5d972
 LDFLAGS-libmarkermod4-1.so += -Wl,-soname,libmarkermod4.so
c5d972
+LDFLAGS-libmarkermod5-1.so += -Wl,-soname,libmarkermod5.so
c5d972
 $(objpfx)libmarkermod%.os : markermodMARKER-VALUE.c
c5d972
 	$(compile-command.c) \
c5d972
 	  -DMARKER=marker$(firstword $(subst -, ,$*)) \
c5d972
@@ -1794,6 +1796,8 @@ $(objpfx)libmarkermod3.so: $(objpfx)libm
c5d972
 	cp $< $@
c5d972
 $(objpfx)libmarkermod4.so: $(objpfx)libmarkermod4-1.so
c5d972
 	cp $< $@
c5d972
+$(objpfx)libmarkermod5.so: $(objpfx)libmarkermod5-1.so
c5d972
+	cp $< $@
c5d972
 
c5d972
 # tst-glibc-hwcaps-prepend checks that --glibc-hwcaps-prepend is
c5d972
 # preferred over auto-detected subdirectories.
c5d972
diff -Nrup a/elf/tst-glibc-hwcaps-cache.script b/elf/tst-glibc-hwcaps-cache.script
c5d972
--- a/elf/tst-glibc-hwcaps-cache.script	2022-05-16 21:48:11.053915558 -0400
c5d972
+++ b/elf/tst-glibc-hwcaps-cache.script	2022-05-16 21:48:56.107095155 -0400
c5d972
@@ -4,6 +4,7 @@
c5d972
 cp $B/elf/libmarkermod2-1.so $L/libmarkermod2.so
c5d972
 cp $B/elf/libmarkermod3-1.so $L/libmarkermod3.so
c5d972
 cp $B/elf/libmarkermod4-1.so $L/libmarkermod4.so
c5d972
+cp $B/elf/libmarkermod5-1.so $L/libmarkermod5.so
c5d972
 
c5d972
 mkdirp 0770 $L/glibc-hwcaps/power9
c5d972
 cp $B/elf/libmarkermod2-2.so $L/glibc-hwcaps/power9/libmarkermod2.so
c5d972
@@ -20,6 +21,11 @@ mkdirp 0770 $L/glibc-hwcaps/z15
c5d972
 cp $B/elf/libmarkermod4-2.so $L/glibc-hwcaps/z13/libmarkermod4.so
c5d972
 cp $B/elf/libmarkermod4-3.so $L/glibc-hwcaps/z14/libmarkermod4.so
c5d972
 cp $B/elf/libmarkermod4-4.so $L/glibc-hwcaps/z15/libmarkermod4.so
c5d972
+mkdirp 0770 $L/glibc-hwcaps/z16
c5d972
+cp $B/elf/libmarkermod5-2.so $L/glibc-hwcaps/z13/libmarkermod5.so
c5d972
+cp $B/elf/libmarkermod5-3.so $L/glibc-hwcaps/z14/libmarkermod5.so
c5d972
+cp $B/elf/libmarkermod5-4.so $L/glibc-hwcaps/z15/libmarkermod5.so
c5d972
+cp $B/elf/libmarkermod5-5.so $L/glibc-hwcaps/z16/libmarkermod5.so
c5d972
 
c5d972
 mkdirp 0770 $L/glibc-hwcaps/x86-64-v2
c5d972
 cp $B/elf/libmarkermod2-2.so $L/glibc-hwcaps/x86-64-v2/libmarkermod2.so
c5d972
diff -Nrup a/sysdeps/s390/dl-procinfo.c b/sysdeps/s390/dl-procinfo.c
c5d972
--- a/sysdeps/s390/dl-procinfo.c	2022-05-16 21:48:11.250916343 -0400
c5d972
+++ b/sysdeps/s390/dl-procinfo.c	2022-05-16 21:48:56.107095155 -0400
c5d972
@@ -64,11 +64,12 @@ PROCINFO_CLASS const char _dl_s390_cap_f
c5d972
 #if !defined PROCINFO_DECL && defined SHARED
c5d972
   ._dl_s390_platforms
c5d972
 #else
c5d972
-PROCINFO_CLASS const char _dl_s390_platforms[10][7]
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
+    "g5", "z900", "z990", "z9-109", "z10", "z196", "zEC12", "z13", "z14", "z15",
c5d972
+    "z16"
c5d972
   }
c5d972
 #endif
c5d972
 #if !defined SHARED || defined PROCINFO_DECL
c5d972
diff -Nrup a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
c5d972
--- a/sysdeps/s390/dl-procinfo.h	2022-05-16 21:48:11.250916343 -0400
c5d972
+++ b/sysdeps/s390/dl-procinfo.h	2022-05-16 21:48:56.107095155 -0400
c5d972
@@ -23,7 +23,7 @@
c5d972
 
c5d972
 #define _DL_HWCAP_COUNT 23
c5d972
 
c5d972
-#define _DL_PLATFORMS_COUNT	10
c5d972
+#define _DL_PLATFORMS_COUNT	11
c5d972
 
c5d972
 /* The kernel provides up to 32 capability bits with elf_hwcap.  */
c5d972
 #define _DL_FIRST_PLATFORM	32
c5d972
diff -Nrup a/sysdeps/s390/s390-64/dl-hwcaps-subdirs.c b/sysdeps/s390/s390-64/dl-hwcaps-subdirs.c
c5d972
--- a/sysdeps/s390/s390-64/dl-hwcaps-subdirs.c	2022-05-16 21:48:11.053915558 -0400
c5d972
+++ b/sysdeps/s390/s390-64/dl-hwcaps-subdirs.c	2022-05-16 21:58:02.840301911 -0400
c5d972
@@ -19,8 +19,8 @@
c5d972
 #include <dl-hwcaps.h>
c5d972
 #include <ldsodefs.h>
c5d972
 
c5d972
-const char _dl_hwcaps_subdirs[] = "z15:z14:z13";
c5d972
-enum { subdirs_count = 3 }; /* Number of components in _dl_hwcaps_subdirs.  */
c5d972
+const char _dl_hwcaps_subdirs[] = "z16:z15:z14:z13";
c5d972
+enum { subdirs_count = 4 }; /* Number of components in _dl_hwcaps_subdirs.  */
c5d972
 
c5d972
 uint32_t
c5d972
 _dl_hwcaps_subdirs_active (void)
c5d972
@@ -50,5 +50,12 @@ _dl_hwcaps_subdirs_active (void)
c5d972
     return _dl_hwcaps_subdirs_build_bitmask (subdirs_count, active);
c5d972
   ++active;
c5d972
 
c5d972
+  /* z16.
c5d972
+   Note: We do not list HWCAP_S390_NNPA here as, according to the Principles of
c5d972
+   Operation, those instructions may be replaced or removed in future.  */
c5d972
+  if (!(GLRO (dl_hwcap) & HWCAP_S390_VXRS_PDE2))
c5d972
+    return _dl_hwcaps_subdirs_build_bitmask (subdirs_count, active);
c5d972
+  ++active;
c5d972
+
c5d972
   return _dl_hwcaps_subdirs_build_bitmask (subdirs_count, active);
c5d972
 }
c5d972
diff -Nrup a/sysdeps/s390/s390-64/Makefile b/sysdeps/s390/s390-64/Makefile
c5d972
--- a/sysdeps/s390/s390-64/Makefile	2022-05-16 21:48:11.053915558 -0400
c5d972
+++ b/sysdeps/s390/s390-64/Makefile	2022-05-16 21:54:08.832355745 -0400
c5d972
@@ -7,8 +7,11 @@ CFLAGS-rtld.c += -Wno-uninitialized -Wno
c5d972
 CFLAGS-dl-load.c += -Wno-unused
c5d972
 CFLAGS-dl-reloc.c += -Wno-unused
c5d972
 
c5d972
-$(objpfx)tst-glibc-hwcaps: $(objpfx)libmarkermod2-1.so \
c5d972
-  $(objpfx)libmarkermod3-1.so $(objpfx)libmarkermod4-1.so
c5d972
+$(objpfx)tst-glibc-hwcaps: \
c5d972
+    $(objpfx)libmarkermod2-1.so \
c5d972
+    $(objpfx)libmarkermod3-1.so \
c5d972
+    $(objpfx)libmarkermod4-1.so \
c5d972
+    $(objpfx)libmarkermod5-1.so
c5d972
 $(objpfx)tst-glibc-hwcaps.out: \
c5d972
   $(objpfx)libmarkermod2.so \
c5d972
     $(objpfx)glibc-hwcaps/z13/libmarkermod2.so \
c5d972
@@ -19,6 +22,11 @@ $(objpfx)tst-glibc-hwcaps.out: \
c5d972
     $(objpfx)glibc-hwcaps/z13/libmarkermod4.so \
c5d972
     $(objpfx)glibc-hwcaps/z14/libmarkermod4.so \
c5d972
     $(objpfx)glibc-hwcaps/z15/libmarkermod4.so \
c5d972
+  $(objpfx)libmarkermod5.so \
c5d972
+    $(objpfx)glibc-hwcaps/z13/libmarkermod5.so \
c5d972
+    $(objpfx)glibc-hwcaps/z14/libmarkermod5.so \
c5d972
+    $(objpfx)glibc-hwcaps/z15/libmarkermod5.so \
c5d972
+    $(objpfx)glibc-hwcaps/z16/libmarkermod5.so
c5d972
 
c5d972
 $(objpfx)glibc-hwcaps/z13/libmarkermod2.so: $(objpfx)libmarkermod2-2.so
c5d972
 	$(make-target-directory)
c5d972
@@ -38,6 +46,18 @@ $(objpfx)glibc-hwcaps/z14/libmarkermod4.
c5d972
 $(objpfx)glibc-hwcaps/z15/libmarkermod4.so: $(objpfx)libmarkermod4-4.so
c5d972
 	$(make-target-directory)
c5d972
 	cp $< $@
c5d972
+$(objpfx)glibc-hwcaps/z13/libmarkermod5.so: $(objpfx)libmarkermod5-2.so
c5d972
+	$(make-target-directory)
c5d972
+	cp $< $@
c5d972
+$(objpfx)glibc-hwcaps/z14/libmarkermod5.so: $(objpfx)libmarkermod5-3.so
c5d972
+	$(make-target-directory)
c5d972
+	cp $< $@
c5d972
+$(objpfx)glibc-hwcaps/z15/libmarkermod5.so: $(objpfx)libmarkermod5-4.so
c5d972
+	$(make-target-directory)
c5d972
+	cp $< $@
c5d972
+$(objpfx)glibc-hwcaps/z16/libmarkermod5.so: $(objpfx)libmarkermod5-5.so
c5d972
+	$(make-target-directory)
c5d972
+	cp $< $@
c5d972
 
c5d972
 ifeq (no,$(build-hardcoded-path-in-tests))
c5d972
 # This is an ld.so.cache test, and RPATH/RUNPATH in the executable
c5d972
diff -Nrup a/sysdeps/s390/s390-64/tst-glibc-hwcaps.c b/sysdeps/s390/s390-64/tst-glibc-hwcaps.c
c5d972
--- a/sysdeps/s390/s390-64/tst-glibc-hwcaps.c	2022-05-16 21:48:11.053915558 -0400
c5d972
+++ b/sysdeps/s390/s390-64/tst-glibc-hwcaps.c	2022-05-16 21:48:56.107095155 -0400
c5d972
@@ -25,6 +25,7 @@
c5d972
 extern int marker2 (void);
c5d972
 extern int marker3 (void);
c5d972
 extern int marker4 (void);
c5d972
+extern int marker5 (void);
c5d972
 
c5d972
 /* Return the arch level, 10 for the baseline libmarkermod*.so's.  */
c5d972
 static int
c5d972
@@ -63,9 +64,13 @@ compute_level (void)
c5d972
     return 12;
c5d972
   if (strcmp (platform, "z15") == 0)
c5d972
     return 13;
c5d972
+  if (strcmp (platform, "z16") == 0)
c5d972
+    return 14;
c5d972
   printf ("warning: unrecognized AT_PLATFORM value: %s\n", platform);
c5d972
   /* Assume that the new platform supports z15.  */
c5d972
   return 13;
c5d972
+  /* Assume that the new platform supports z16.  */
c5d972
+  return 14;
c5d972
 }
c5d972
 
c5d972
 static int
c5d972
@@ -76,6 +81,7 @@ do_test (void)
c5d972
   TEST_COMPARE (marker2 (), MIN (level - 9, 2));
c5d972
   TEST_COMPARE (marker3 (), MIN (level - 9, 3));
c5d972
   TEST_COMPARE (marker4 (), MIN (level - 9, 4));
c5d972
+  TEST_COMPARE (marker5 (), MIN (level - 9, 5));
c5d972
   return 0;
c5d972
 }
c5d972