This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] malloc: Use compat_symbol_reference in libmcheck [BZ #22050]


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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]