tcmalloc.patch 1.0 KB

12345678910111213141516171819202122232425
  1. diff --git a/distro/google-perftools-1.7/src/tcmalloc.cc b/distro/google-perftools-1.7/src/tcmalloc.cc
  2. index 8d94d20..0769425 100644
  3. --- a/distro/google-perftools-1.7/src/tcmalloc.cc
  4. +++ b/distro/google-perftools-1.7/src/tcmalloc.cc
  5. @@ -137,6 +137,13 @@
  6. # define WIN32_DO_PATCHING 1
  7. #endif
  8. +// GLibc 2.14+ requires the hook functions be declared volatile, based on the value of the
  9. +// define __MALLOC_HOOK_VOLATILE. For compatibility with older/non-GLibc implementations,
  10. +// provide an empty definition.
  11. +#if !defined(__MALLOC_HOOK_VOLATILE)
  12. +#define __MALLOC_HOOK_VOLATILE
  13. +#endif
  14. +
  15. using STL_NAMESPACE::max;
  16. using STL_NAMESPACE::numeric_limits;
  17. using STL_NAMESPACE::vector;
  18. @@ -1669,5 +1676,5 @@ static void *MemalignOverride(size_t align, size_t size, const void *caller)
  19. MallocHook::InvokeNewHook(result, size);
  20. return result;
  21. }
  22. -void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
  23. +void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
  24. #endif // #ifndef TCMALLOC_FOR_DEBUGALLOCATION