SHA256
1
0
forked from pool/glibc
glibc/powerpc-elision-enable-envvar.patch
Andreas Schwab db39c1fdd1 Accepting request 377337 from home:Andreas_Schwab:Factory
- powerpc-elision-enable-envvar.patch: enable TLE only if
  GLIBC_ELISION_ENABLE=yes is defined (bsc#967594, fate#318236)

OBS-URL: https://build.opensuse.org/request/show/377337
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=430
2016-03-22 10:25:18 +00:00

42 lines
1.5 KiB
Diff

2016-02-11 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/elision-conf.c
(elision_init): Further restrict enablement based
on whether GLIBC_ELISION_ENABLE=yes is in the env.
---
sysdeps/unix/sysv/linux/powerpc/elision-conf.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
Index: glibc-2.22/sysdeps/unix/sysv/linux/powerpc/elision-conf.c
===================================================================
--- glibc-2.22.orig/sysdeps/unix/sysv/linux/powerpc/elision-conf.c
+++ glibc-2.22/sysdeps/unix/sysv/linux/powerpc/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. */
@@ -61,7 +62,18 @@ elision_init (int argc __attribute__ ((u
{
#ifdef ENABLE_LOCK_ELISION
int elision_available = (GLRO (dl_hwcap2) & PPC_FEATURE2_HAS_HTM) ? 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;
+ }
+ }
#endif
if (!__pthread_force_elision)
/* Disable elision on rwlocks. */