diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-01-09 10:42:33 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-01-09 10:42:33 +0000 |
commit | e145f1cc757e1213c0d5fc51251db6a6f8bd04a0 (patch) | |
tree | e00625d026371d5085c1cb5af253c56af2ee4311 /elf/dl-fini.c | |
parent | 29f976542bf6589ebad2ee60b855e01ad3c33016 (diff) | |
download | glibc-e145f1cc757e1213c0d5fc51251db6a6f8bd04a0.tar.gz glibc-e145f1cc757e1213c0d5fc51251db6a6f8bd04a0.tar.xz glibc-e145f1cc757e1213c0d5fc51251db6a6f8bd04a0.zip |
Update.
* elf/dl-fini.c (_dl_fini): Call destructors of audit DSOs after those of all the regular objects.
Diffstat (limited to 'elf/dl-fini.c')
-rw-r--r-- | elf/dl-fini.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/elf/dl-fini.c b/elf/dl-fini.c index 8fc5dbf123..b3282089a9 100644 --- a/elf/dl-fini.c +++ b/elf/dl-fini.c @@ -1,5 +1,5 @@ /* Call the termination functions of loaded shared objects. - Copyright (C) 1995,96,1998-2002,2004 Free Software Foundation, Inc. + Copyright (C) 1995,96,1998-2002,2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -48,6 +48,10 @@ _dl_fini (void) /* We run the destructors of the main namespaces last. As for the other namespaces, we pick run the destructors in them in reverse order of the namespace ID. */ +#ifdef SHARED + int do_audit = 0; + again: +#endif for (Lmid_t cnt = DL_NNS - 1; cnt >= 0; --cnt) { /* Protect against concurrent loads and unloads. */ @@ -57,7 +61,11 @@ _dl_fini (void) unsigned int nloaded = GL(dl_ns)[cnt]._ns_nloaded; /* No need to do anything for empty namespaces or those used for auditing DSOs. */ - if (nloaded == 0 || GL(dl_ns)[cnt]._ns_loaded->l_auditing) + if (nloaded == 0 +#ifdef SHARED + || GL(dl_ns)[cnt]._ns_loaded->l_auditing != do_audit +#endif + ) goto out; /* XXX Could it be (in static binaries) that there is no object @@ -213,7 +221,7 @@ _dl_fini (void) #ifdef SHARED /* Auditing checkpoint: another object closed. */ - if (__builtin_expect (GLRO(dl_naudit) > 0, 0)) + if (!do_audit && __builtin_expect (GLRO(dl_naudit) > 0, 0)) { struct audit_ifaces *afct = GLRO(dl_audit); for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt) @@ -233,6 +241,14 @@ _dl_fini (void) } } +#ifdef SHARED + if (! do_audit && GLRO(dl_naudit) > 0) + { + do_audit = 1; + goto again; + } +#endif + if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS, 0)) _dl_debug_printf ("\nruntime linker statistics:\n" " final number of relocations: %lu\n" |