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