File s390-elision-enable-envvar.patch of Package glibc.13450

Index: glibc-2.25/sysdeps/unix/sysv/linux/s390/elision-conf.c
===================================================================
--- glibc-2.25.orig/sysdeps/unix/sysv/linux/s390/elision-conf.c
+++ glibc-2.25/sysdeps/unix/sysv/linux/s390/elision-conf.c
@@ -21,6 +21,7 @@
 #include <elision-conf.h>
 #include <unistd.h>
 #include <dl-procinfo.h>
+#include <string.h>
 
 /* Reasonable initial tuning values, may be revised in the future.
    This is a conservative initial value.  */
@@ -64,7 +65,17 @@ elision_init (int argc __attribute__ ((u
      When false elision is never attempted.  */
   int elision_available = (GLRO (dl_hwcap) & HWCAP_S390_TE) ? 1 : 0;
 
-  __pthread_force_elision = __libc_enable_secure ? 0 : elision_available;
+  /* Scan the environment and conditionally enable TLE.  */
+  if (elision_available != 0 && __libc_enable_secure == 0)
+    {
+      for ( ; *environ != NULL; environ++)
+	if (**environ == 'G'
+	    && strcmp (*environ, "GLIBC_ELISION_ENABLE=yes") == 0)
+	  {
+	    __pthread_force_elision = elision_available;
+	    break;
+	  }
+    }
 }
 
 #ifdef SHARED
openSUSE Build Service is sponsored by