mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
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 <stdc-predef.h>.
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user