From 269f60eced4510841b912bc083b873cbd9591c1d Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Wed, 11 Oct 2017 15:26:06 -0400 Subject: [PATCH] add configure option to disable generic dynamic tls model, do so for s390x and aarch64, add aligned_alloc support --- gperftools-2.6.1-aligned_alloc.patch | 33 +++++++++++++++++++ ...ls-2.6.1-disable-generic-dynamic-tls.patch | 32 ++++++++++++++++++ gperftools.spec | 22 ++++++++++++- 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 gperftools-2.6.1-aligned_alloc.patch create mode 100644 gperftools-2.6.1-disable-generic-dynamic-tls.patch diff --git a/gperftools-2.6.1-aligned_alloc.patch b/gperftools-2.6.1-aligned_alloc.patch new file mode 100644 index 0000000..3970167 --- /dev/null +++ b/gperftools-2.6.1-aligned_alloc.patch @@ -0,0 +1,33 @@ +diff -up gperftools-2.6.1/Makefile.am.aa gperftools-2.6.1/Makefile.am +--- gperftools-2.6.1/Makefile.am.aa 2017-10-11 15:17:39.618807653 -0400 ++++ gperftools-2.6.1/Makefile.am 2017-10-11 15:17:59.331338671 -0400 +@@ -97,6 +97,7 @@ endif OSX + if HAVE_OBJCOPY_WEAKEN + WEAKEN = $(OBJCOPY) -W malloc -W free -W realloc -W calloc -W cfree \ + -W memalign -W posix_memalign -W valloc -W pvalloc \ ++ -W aligned_alloc \ + -W malloc_stats -W mallopt -W mallinfo -W nallocx \ + -W _Znwm -W _ZnwmRKSt9nothrow_t -W _Znam -W _ZnamRKSt9nothrow_t \ + -W _ZdlPv -W _ZdaPv \ +diff -up gperftools-2.6.1/src/libc_override_gcc_and_weak.h.aa gperftools-2.6.1/src/libc_override_gcc_and_weak.h +--- gperftools-2.6.1/src/libc_override_gcc_and_weak.h.aa 2017-10-11 15:18:32.234555868 -0400 ++++ gperftools-2.6.1/src/libc_override_gcc_and_weak.h 2017-10-11 15:18:38.243412911 -0400 +@@ -143,6 +143,7 @@ extern "C" { + void* calloc(size_t n, size_t size) __THROW ALIAS(tc_calloc); + void cfree(void* ptr) __THROW ALIAS(tc_cfree); + void* memalign(size_t align, size_t s) __THROW ALIAS(tc_memalign); ++ void* aligned_alloc(size_t align, size_t s) __THROW ALIAS(tc_memalign); + void* valloc(size_t size) __THROW ALIAS(tc_valloc); + void* pvalloc(size_t size) __THROW ALIAS(tc_pvalloc); + int posix_memalign(void** r, size_t a, size_t s) __THROW +diff -up gperftools-2.6.1/src/libc_override_redefine.h.aa gperftools-2.6.1/src/libc_override_redefine.h +--- gperftools-2.6.1/src/libc_override_redefine.h.aa 2017-10-11 15:18:55.012013968 -0400 ++++ gperftools-2.6.1/src/libc_override_redefine.h 2017-10-11 15:19:20.528406906 -0400 +@@ -71,6 +71,7 @@ extern "C" { + void* calloc(size_t n, size_t s) { return tc_calloc(n, s); } + void cfree(void* p) { tc_cfree(p); } + void* memalign(size_t a, size_t s) { return tc_memalign(a, s); } ++ void* aligned_alloc(size_t a, size_t s) { return tc_memalign(a, s); } + void* valloc(size_t s) { return tc_valloc(s); } + void* pvalloc(size_t s) { return tc_pvalloc(s); } + int posix_memalign(void** r, size_t a, size_t s) { diff --git a/gperftools-2.6.1-disable-generic-dynamic-tls.patch b/gperftools-2.6.1-disable-generic-dynamic-tls.patch new file mode 100644 index 0000000..ae87e5d --- /dev/null +++ b/gperftools-2.6.1-disable-generic-dynamic-tls.patch @@ -0,0 +1,32 @@ +diff -up ./configure.ac.dynload ./configure.ac +--- ./configure.ac.dynload 2017-08-24 15:23:01.126622099 -0400 ++++ ./configure.ac 2017-08-24 15:29:46.332132222 -0400 +@@ -614,6 +614,16 @@ AC_COMPILE_IFELSE( + 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 -up ./src/base/basictypes.h.dynload ./src/base/basictypes.h +--- ./src/base/basictypes.h.dynload 2017-08-24 15:30:30.210996293 -0400 ++++ ./src/base/basictypes.h 2017-08-24 15:31:01.889176214 -0400 +@@ -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 diff --git a/gperftools.spec b/gperftools.spec index 9236583..145e973 100644 --- a/gperftools.spec +++ b/gperftools.spec @@ -4,7 +4,7 @@ Name: gperftools Version: 2.6.1 -Release: 3%{?dist} +Release: 5%{?dist} License: BSD Group: Development/Tools Summary: Very fast malloc and performance analysis tools @@ -12,12 +12,18 @@ URL: https://github.com/gperftools/gperftools Source0: https://github.com/gperftools/gperftools/releases/download/%{name}-%{version}/%{name}-%{version}.tar.gz # There is no ucontext typedef on ppc64, at least not in rawhide. Patch0: gperftools-2.6.1-ppc64-ucontext-fix.patch +# Conditionalize generic dynamic tls model +Patch1: gperftools-2.6.1-disable-generic-dynamic-tls.patch +# Add support for C11 aligned_alloc +# https://github.com/gperftools/gperftools/commit/d406f228 +Patch2: gperftools-2.6.1-aligned_alloc.patch ExcludeArch: s390 %ifnarch s390x BuildRequires: libunwind-devel %endif BuildRequires: perl-generators +BuildRequires: autoconf, automake, libtool Requires: gperftools-devel = %{version}-%{release} Requires: pprof = %{version}-%{release} @@ -61,6 +67,8 @@ Pprof is a heap and CPU profiler tool, part of the gperftools suite. %prep %setup -q %patch0 -p1 -b .ucontextfix +%patch1 -p1 -b .dynload +%patch2 -p1 -b .aa # Fix end-of-line encoding sed -i 's/\r//' README_windows.txt @@ -68,10 +76,15 @@ sed -i 's/\r//' README_windows.txt # No need to have exec permissions on source code chmod -x src/*.h src/*.cc +autoreconf -ifv + %build CFLAGS=`echo $RPM_OPT_FLAGS -fno-strict-aliasing -Wno-unused-local-typedefs -DTCMALLOC_LARGE_PAGES | sed -e 's|-fexceptions||g'` CXXFLAGS=`echo $RPM_OPT_FLAGS -fno-strict-aliasing -Wno-unused-local-typedefs -DTCMALLOC_LARGE_PAGES | sed -e 's|-fexceptions||g'` %configure \ +%ifarch s390x aarch64 + --disable-general-dynamic-tls \ +%endif --disable-dynamic-sized-delete-support \ --disable-static @@ -115,6 +128,13 @@ rm -rf %{buildroot}%{_pkgdocdir}/INSTALL %{_libdir}/*.so.* %changelog +* Wed Oct 11 2017 Tom Callaway - 2.6.1-5 +- add aligned_alloc support + +* Thu Aug 24 2017 Tom Callaway - 2.6.1-4 +- add configure option to disable generic dynamic tls model +- disable generic dynamic tls model on s390x and aarch64 + * Wed Aug 02 2017 Fedora Release Engineering - 2.6.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild