This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] malloc: Use compat_symbol_reference in libmcheck [BZ #22050]
- From: fweimer at redhat dot com (Florian Weimer)
- To: libc-alpha at sourceware dot org
- Date: Thu, 31 Aug 2017 11:52:13 +0200
- Subject: [PATCH] malloc: Use compat_symbol_reference in libmcheck [BZ #22050]
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=fweimer at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 34FB97E439
Since glibc 2.24, __malloc_initialize_hook is a compat symbol. As a
result, the link editor does not export a definition of
__malloc_initialize_hook from the main program, so that it no longer
interposes the variable definition in libc.so. Specifying the symbol
version restores the exported symbol.
2017-08-31 Florian Weimer <fweimer@redhat.com>
[BZ #22050]
* malloc/mcheck-init.c (__malloc_initialize_hook): Use
compat_symbol_reference to access non-default version.
diff --git a/malloc/mcheck-init.c b/malloc/mcheck-init.c
index 6d2492ef7e..4ebfa868ea 100644
--- a/malloc/mcheck-init.c
+++ b/malloc/mcheck-init.c
@@ -20,6 +20,7 @@
#include <malloc.h>
#include <mcheck.h>
+#include <shlib-compat.h>
static void
turn_on_mcheck (void)
@@ -28,3 +29,7 @@ turn_on_mcheck (void)
}
void (*__malloc_initialize_hook) (void) = turn_on_mcheck;
+/* Slight abuse of compat_symbol_reference because the above is not a
+ reference, but actually a definition. */
+compat_symbol_reference (libc, __malloc_initialize_hook,
+ __malloc_initialize_hook, GLIBC_2_0);