Files
gentoo/dev-util/google-perftools/files/google-perftools-2.9.1-disable-generic-dynamic-tls.patch
Sam James dd53c589c7 dev-util/google-perftools: add Fedora TLS patch for arm64
Use Fedora's TLS (thread local storage) patch to fix segfaults
in consumers on e.g. arm64. We also apply the new
configure option on s390 as Fedora do, but there might
be other arches where this is needed.

Bug: https://bugs.gentoo.org/818871
Signed-off-by: Sam James <sam@gentoo.org>
2021-10-27 06:34:03 +01:00

35 lines
1.4 KiB
Diff

Grabbed from Fedora: https://src.fedoraproject.org/rpms/gperftools/blob/rawhide/f/gperftools-2.7.90-disable-generic-dynamic-tls.patch
Allows consumers to work correctly on arm64.
--- a/configure.ac
+++ b/configure.ac
@@ -665,6 +665,17 @@ AS_IF([test "x$enable_aggressive_decommi
1,
[enable aggressive decommit by default])])
+# Enable generic dynamic TLS model 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])
--- 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