diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-02-14 21:25:50 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-02-14 21:25:50 +0000 |
commit | 43c59a705b67a3078cb1d8fd8ff6ce00ea9bdeee (patch) | |
tree | 86f2fd362b0471498253d720e5c14a5a6d69daf5 /sysdeps/generic | |
parent | e38c954b3bebd37f7519202d918cf0f1edbdd182 (diff) | |
download | glibc-43c59a705b67a3078cb1d8fd8ff6ce00ea9bdeee.tar glibc-43c59a705b67a3078cb1d8fd8ff6ce00ea9bdeee.tar.gz glibc-43c59a705b67a3078cb1d8fd8ff6ce00ea9bdeee.tar.bz2 glibc-43c59a705b67a3078cb1d8fd8ff6ce00ea9bdeee.zip |
* csu/elf-init.c (__libc_csu_fini): Enable if LIBC_NONSHARED
isn't defined.
* sysdeps/generic/libc-start.c (LIBC_START_MAIN): Call fini
if SHARED isn't defined.
* elf/Makefile (tests-static): Add tst-array1-static.
($(objpfx)tst-array1-static.out): New target.
* elf/tst-array1-static.c: New file.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/libc-start.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c index 5bb8a9b352..fdf398ada6 100644 --- a/sysdeps/generic/libc-start.c +++ b/sysdeps/generic/libc-start.c @@ -81,9 +81,9 @@ STATIC int LIBC_START_MAIN (int (*main) (int, char **, char ** __attribute__ ((noreturn)); -/* Note: the fini parameter is ignored here. It used to be registered - with __cxa_atexit. This had the disadvantage that finalizers were - called in more than one place. */ +/* Note: the fini parameter is ignored here for shared library. It + is registered with __cxa_atexit. This had the disadvantage that + finalizers were called in more than one place. */ STATIC int LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), int argc, char *__unbounded *__unbounded ubp_av, @@ -155,14 +155,16 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), if (__builtin_expect (rtld_fini != NULL, 1)) __cxa_atexit ((void (*) (void *)) rtld_fini, NULL, NULL); +#ifndef SHARED /* Call the initializer of the libc. This is only needed here if we are compiling for the static library in which case we haven't run the constructors in `_dl_start_user'. */ -#ifndef SHARED __libc_init_first (argc, argv, __environ); -#endif -#ifndef SHARED + /* Register the destructor of the program, if any. */ + if (fini) + __cxa_atexit ((void (*) (void *)) fini, NULL, NULL); + /* Some security at this point. Prevent starting a SUID binary where the standard file descriptors are not opened. We have to do this only for statically linked applications since otherwise the dynamic |