From 2ab82df5d631f5da10da2ff73b515a8aa25fe819 Mon Sep 17 00:00:00 2001
Date: Tue, 22 Sep 2020 20:38:53 +0800
Subject: [PATCH] enable-generic-dynamic-tls

fedora has a patch for aarch64, which fixes this issue https://gitee.com/src-openeuler/gperftools/issues/I1VAEU

---
 configure.ac          | 10 ++++++++++
 src/base/basictypes.h |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 500f8be..b1b12f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -670,6 +670,16 @@ AS_IF([test "x$enable_aggressive_decommit_by_default" = xyes],
                  1,
                  [enable aggressive decommit by default])])
 
+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 --git a/src/base/basictypes.h b/src/base/basictypes.h
index 356b3d5..b737d47 100644
--- a/src/base/basictypes.h
+++ b/src/base/basictypes.h
@@ -200,7 +200,7 @@ struct CompileAssert {
 # 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
-- 
1.8.3.1

