[PATCH] malloc: Use compat_symbol_reference in libmcheck [BZ #22050]
Carlos O'Donell
carlos@redhat.com
Thu Aug 31 15:23:00 GMT 2017
On 08/31/2017 04:52 AM, Florian Weimer wrote:
> 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);
>
We deprecated __malloc_initialize_hook in libc.so.6. There is only a compat
symbol there, which can only be interposed by a definition of the same version.
In libmcheck.a we have __malloc_initialize_hook (unversioned) which no longer
interposes the symbol in libc.so.6 (it would have interposed the default if
there was one).
So what does the compat_symbol_reference create in the libmcheck.a? An undefined
reference to __malloc_initialize_hook@GLIBC_2_0?
--
Cheers,
Carlos.
More information about the Libc-alpha
mailing list