diff -Naur gperftools-2.7.old/configure.ac gperftools-2.7/configure.ac --- gperftools-2.7.old/configure.ac 2018-04-30 13:59:43.000000000 +0800 +++ gperftools-2.7/configure.ac 2019-08-27 14:19:09.288374428 +0800 @@ -653,6 +653,16 @@ AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) +default_enable_generic_dynamic_tls=yes +AC_ARG_ENABLE([general-dynamic-tls], + [AS_HELP_STRING([--disable-general-dynamic-tls], + [Do not use the general dynamic TLS model])], + [], + [enable_generic_dynamic_tls="$default_enable_generic_dynamic_tls"]) +AS_IF([test "x$enable_generic_dynamic_tls" = xyes], + [AC_DEFINE([ENABLE_GENERIC_DYNAMIC_TLS], 1, + [Use the generic dynamic TLS model])]) + # Write generated configuration file AC_CONFIG_FILES([Makefile src/gperftools/tcmalloc.h src/windows/gperftools/tcmalloc.h]) diff -Naur gperftools-2.7.old/src/base/basictypes.h gperftools-2.7/src/base/basictypes.h --- gperftools-2.7.old/src/base/basictypes.h 2018-02-25 12:37:40.000000000 +0800 +++ gperftools-2.7/src/base/basictypes.h 2019-08-27 14:19:09.292374700 +0800 @@ -200,7 +200,7 @@ # define ATTRIBUTE_UNUSED #endif -#if defined(HAVE___ATTRIBUTE__) && defined(HAVE_TLS) +#if defined(HAVE___ATTRIBUTE__) && defined(HAVE_TLS) && defined(ENABLE_GENERIC_DYNAMIC_TLS) #define ATTR_INITIAL_EXEC __attribute__ ((tls_model ("initial-exec"))) #else #define ATTR_INITIAL_EXEC diff -Naur gperftools-2.7.old/src/heap-checker.cc gperftools-2.7/src/heap-checker.cc --- gperftools-2.7.old/src/heap-checker.cc 2017-12-10 00:29:18.000000000 +0800 +++ gperftools-2.7/src/heap-checker.cc 2019-08-27 14:19:20.461133467 +0800 @@ -445,7 +445,7 @@ // the cost you can't dlopen this library. But dlopen on heap-checker // doesn't work anyway -- it must run before main -- so this is a good // trade-off. -# ifdef HAVE___ATTRIBUTE__ +# if defined(HAVE___ATTRIBUTE__) && defined(ENABLE_GENERIC_DYNAMIC_TLS) __attribute__ ((tls_model ("initial-exec"))) # endif ;