Add option a new sim-hint  no-nptl-pthread-stackcache.

Activating this hint using --sim-hints=no-nptl-pthread-stackcache
means the glibc nptl stack cache will be disabled.

Disabling this stack/tls cache avoids helgrind false positive race conditions
errors when using __thread variables.

Note: disabling the stack cache is done by a kludge, dependent on
internal knowledge of glibc code, and using libpthread debug info.
So, this kludge might be broken with newer glibc version.
This has been tested on various platforms and various
glibc versions 2.11, 2.16 and 2.18

To check if the disabling works, you can do:
valgrind --tool=helgrind --sim-hints=no-nptl-pthread-stackcache -d -v ./helgrind/tests/tls_threads |& grep kludge

If you see the below 2 lines, then hopefully the stack cache has been disabled.
--12624-- deactivate nptl pthread stackcache via kludge: found symbol stack_cache_actsize at addr 0x3AF178
--12624:1:sched    pthread stack cache size disabling done via kludge




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14313 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index 1a3374c..fc0c8c9 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -175,8 +175,8 @@
 "    --vgdb-prefix=<prefix>    prefix for vgdb FIFOs [%s]\n"
 "    --run-libc-freeres=no|yes free up glibc memory at exit on Linux? [yes]\n"
 "    --sim-hints=hint1,hint2,...  activate unusual sim behaviours [none] \n"
-"         where hint is one of no-inner-prefix lax-ioctls enable-outer\n"
-"                 fuse-compatible none\n"
+"         where hint is one of lax-ioctls fuse-compatible enable-outer\n"
+"           no-inner-prefix no-nptl-pthread-stackcache none\n"
 "    --fair-sched=no|yes|try   schedule threads fairly on multicore systems [no]\n"
 "    --kernel-variant=variant1,variant2,...  handle non-standard kernel"
                                                                " variants [none]\n"
@@ -380,7 +380,8 @@
       // as early as possible.
       else if VG_USETX_CLO (str, "--sim-hints",
                             "no-inner-prefix,fuse-compatible,"
-                            "lax-ioctls,enable-outer",
+                            "lax-ioctls,enable-outer,"
+                            "no-nptl-pthread-stackcache",
                             VG_(clo_sim_hints)) {}
    }
 }