From 2ba3cfa1607c36613f3b30fb1ae4ec530245ce64 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 10 Jun 2016 10:46:05 +0200 Subject: malloc: Remove __malloc_initialize_hook from the API [BZ #19564] __malloc_initialize_hook is interposed by application code, so the usual approach to define a compatibility symbol does not work. This commit adds a new mechanism based on #pragma GCC poison in . --- malloc/malloc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'malloc/malloc.c') diff --git a/malloc/malloc.c b/malloc/malloc.c index 6f77d372a8..ac0f751593 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -491,6 +491,15 @@ void *(*__morecore)(ptrdiff_t) = __default_morecore; #define HAVE_MREMAP 0 #endif +/* We may need to support __malloc_initialize_hook for backwards + compatibility. */ + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_24) +# define HAVE_MALLOC_INIT_HOOK 1 +#else +# define HAVE_MALLOC_INIT_HOOK 0 +#endif + /* This version of malloc supports the standard SVID/XPG mallinfo @@ -1841,7 +1850,12 @@ static void *realloc_hook_ini (void *ptr, size_t sz, static void *memalign_hook_ini (size_t alignment, size_t sz, const void *caller) __THROW; -void weak_variable (*__malloc_initialize_hook) (void) = NULL; +#if HAVE_MALLOC_INIT_HOOK +void weak_variable (*old__malloc_initialize_hook) (void) = NULL; +compat_symbol (libc, old__malloc_initialize_hook, + old__malloc_initialize_hook, GLIBC_2_0); +#endif + void weak_variable (*__free_hook) (void *__ptr, const void *) = NULL; void *weak_variable (*__malloc_hook) -- cgit v1.2.3