2005-01-09 Ulrich Drepper <drepper@redhat.com>
+ * elf/dl-fini.c (_dl_fini): Call destructors of audit DSOs after
+ those of all the regular objects.
+
* elf/dl-debug.c (_dl_debug_initialize): Take extra parameter and
use it to select the r_debug structure for that namespace.
* elf/dl-close.c (_dl_close): Adjust call to _dl_debug_initialize.
/* 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
/* 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. */
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
#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)
}
}
+#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"