mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
malloc: Improve malloc initialization
Move malloc initialization to __libc_early_init. Use a hidden __ptmalloc_init for initialization and a weak call to avoid pulling in the system malloc in a static binary. All previous initialization checks can now be removed. Reviewed-by: Florian Weimer <fweimer@redhat.com>
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <pthread_early_init.h>
|
||||
#include <sys/single_threaded.h>
|
||||
#include <getrandom-internal.h>
|
||||
#include <malloc/malloc-internal.h>
|
||||
|
||||
#ifdef SHARED
|
||||
_Bool __libc_initial;
|
||||
@@ -32,6 +33,9 @@ _Bool __libc_initial;
|
||||
void
|
||||
__libc_early_init (_Bool initial)
|
||||
{
|
||||
/* Initialize system malloc. */
|
||||
call_function_static_weak (__ptmalloc_init);
|
||||
|
||||
/* Initialize ctype data. */
|
||||
__ctype_init ();
|
||||
|
||||
|
Reference in New Issue
Block a user