This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi, Here is the patch for the glibc bug, libc/1305. It is for glibc 2.1. I am not sure how to fix glibc 2.2. Maybe we should use DT_PREINIT. -- H.J. Lu (hjl@gnu.org) --- Sat Oct 2 16:38:20 1999 H.J. Lu <hjl@gnu.org> * sysdeps/generic/libc-start.c (__libc_start_main): Call __libc_preinit (). * csu/set-init.c (__libc_preinit): New. * csu/munch-tmpl.c (__libc_preinit): New, a dummy. * malloc/malloc.c (ptmalloc_init): New, set to __libc_subpreinit. Index: sysdeps/generic/libc-start.c =================================================================== RCS file: /work/cvs/gnu/glibc-2.1/sysdeps/generic/libc-start.c,v retrieving revision 1.2 diff -u -p -r1.2 libc-start.c --- sysdeps/generic/libc-start.c 1999/08/08 17:03:51 1.2 +++ sysdeps/generic/libc-start.c 1999/10/02 23:38:18 @@ -24,6 +24,7 @@ #include <sys/ioctl.h> #include <elf/ldsodefs.h> +extern void __libc_preinit (int argc, char **argv, char **envp); extern void __libc_init_first (int argc, char **argv, char **envp); extern int _dl_starting_up; @@ -59,6 +60,14 @@ __libc_start_main (int (*main) (int, cha if (__libc_enable_secure) check_standard_fds (); + /* Call the preinitializer of the libc. */ +#ifdef SHARED + if (_dl_debug_impcalls) + _dl_debug_message (1, "\npreinitialize libc\n\n", NULL); +#endif + __libc_preinit (argc, argv, __environ); + + /* Register the destructor of the program, if any. */ /* Register the destructor of the dynamic linker if there is any. */ if (rtld_fini != NULL) atexit (rtld_fini); Index: csu/set-init.c =================================================================== RCS file: /work/cvs/gnu/glibc-2.1/csu/set-init.c,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 set-init.c --- csu/set-init.c 1998/05/09 20:38:38 1.1.1.1 +++ csu/set-init.c 1999/10/02 23:11:51 @@ -21,3 +21,6 @@ DEFINE_HOOK_RUNNER (__libc_subinit, __libc_init, (int argc, char **argv, char **envp), (argc, argv, envp)) + +DEFINE_HOOK_RUNNER (__libc_subpreinit, __libc_preinit, + (int argc, char **argv, char **envp), (argc, argv, envp)) Index: csu/munch-tmpl.c =================================================================== RCS file: /work/cvs/gnu/glibc-2.1/csu/munch-tmpl.c,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 munch-tmpl.c --- csu/munch-tmpl.c 1998/05/09 20:38:38 1.1.1.1 +++ csu/munch-tmpl.c 1999/10/02 23:30:50 @@ -36,3 +36,8 @@ __libc_init (int argc, char **argv, char } #endif } + +void +__libc_preinit (int argc, char **argv, char **envp) +{ +} Index: malloc/malloc.c =================================================================== RCS file: /work/cvs/gnu/glibc-2.1/malloc/malloc.c,v retrieving revision 1.1.1.27 diff -u -p -r1.1.1.27 malloc.c --- malloc/malloc.c 1999/10/02 16:56:31 1.1.1.27 +++ malloc/malloc.c 1999/10/02 23:17:48 @@ -4670,6 +4670,10 @@ weak_alias (__malloc_get_state, malloc_g weak_alias (__malloc_set_state, malloc_set_state) #endif +#ifdef HAVE_GNU_LD +text_set_element (__libc_subpreinit, ptmalloc_init); +#endif + /* History:
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |