[PATCH] malloc: Clean up __malloc_initialized
Florian Weimer
fweimer@redhat.com
Fri Jun 18 09:36:45 GMT 2021
* Siddhesh Poyarekar via Libc-alpha:
> -/* In the GNU libc we rename the global variable
> - `__malloc_initialized' to `__libc_malloc_initialized'. */
> -#define __malloc_initialized __libc_malloc_initialized
> -/* Nonzero if the malloc is already initialized. */
> -extern int __malloc_initialized attribute_hidden;
You need to provide the attribute_hidden somewhere, otherwise you'll get
worse code on some targets.
> diff --git a/malloc/mcheck.c b/malloc/mcheck.c
> index 2a1fc645d4..93d7992a41 100644
> --- a/malloc/mcheck.c
> +++ b/malloc/mcheck.c
> @@ -21,6 +21,7 @@
> # define _MALLOC_INTERNAL
> # include <malloc.h>
> # include <mcheck.h>
> +# include <stdbool.h>
> # include <stdint.h>
> # include <stdio.h>
> # include <libintl.h>
> @@ -372,10 +373,12 @@ mabort (enum mcheck_status status)
> int
> mcheck (void (*func) (enum mcheck_status))
> {
> + extern bool __malloc_initialized;
> +
This suggests that __malloc_initialized should remain in the wrapper
header.
Thanks,
Florian
More information about the Libc-alpha
mailing list