This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[COMMITTED] Add informative comments in _dl_close_worker.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 09 May 2013 17:40:04 -0400
- Subject: [COMMITTED] Add informative comments in _dl_close_worker.
I had to do an audit of this code today so I have checked in some more
informative comments about what the dependency checking code does.
2013-05-09 Carlos O'Donell <carlos@redhat.com>
* elf/dl-close.c (_dl_close_worker): Add comments.
diff --git a/elf/dl-close.c b/elf/dl-close.c
index c86f609..acc0066 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -183,6 +183,8 @@ _dl_close_worker (struct link_map *map)
/* Mark all dependencies as used. */
if (l->l_initfini != NULL)
{
+ /* We are always the zeroth entry, and since we don't include
+ ourselves in the dependency analysis start at 1. */
struct link_map **lp = &l->l_initfini[1];
while (*lp != NULL)
{
@@ -193,6 +195,10 @@ _dl_close_worker (struct link_map *map)
if (!used[(*lp)->l_idx])
{
used[(*lp)->l_idx] = 1;
+ /* If we marked a new object as used, and we've
+ already processed it, then we need to go back
+ and process again from that point forward to
+ ensure we keep all of its dependencies also. */
if ((*lp)->l_idx - 1 < done_index)
done_index = (*lp)->l_idx - 1;
}
---
Cheers,
Carlos.