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