aboutsummaryrefslogtreecommitdiff
path: root/malloc/malloc.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-06-10 10:46:05 +0200
committerFlorian Weimer <fweimer@redhat.com>2016-06-10 10:46:05 +0200
commit2ba3cfa1607c36613f3b30fb1ae4ec530245ce64 (patch)
tree4c215fe75ef1c016943e36821137257480097e01 /malloc/malloc.c
parentf00faa4a43706d85ad8d4d2c970d3f52f0f63bfb (diff)
downloadglibc-2ba3cfa1607c36613f3b30fb1ae4ec530245ce64.zip
glibc-2ba3cfa1607c36613f3b30fb1ae4ec530245ce64.tar.gz
glibc-2ba3cfa1607c36613f3b30fb1ae4ec530245ce64.tar.bz2
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>.
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r--malloc/malloc.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 6f77d37..ac0f751 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)