1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00

* elf/dl-close.c (_dl_close): If dependency is not unloaded make

sure no reference to the unloaded map's search list remains in the
	dependency's scope.

2006-09-16  Jakub Jelinek  <jakub@redhat.com>

	* elf/Makefile: Add rules to build and run unload7 test.
	* elf/unload7.c: New test.
	* elf/unload7mod1.c: New file.
	* elf/unload7mod2.c: New file.
This commit is contained in:
Ulrich Drepper
2006-09-19 14:42:12 +00:00
parent 0466106efc
commit 1ee2ff2053
6 changed files with 90 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/* Close a shared object opened by `_dl_open'.
Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 1996-2005, 2006 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
@@ -330,7 +330,7 @@ _dl_close (void *_map)
for (cnt = 0; imap->l_scope[cnt] != NULL; ++cnt)
/* This relies on l_scope[] entries being always set either
to its own l_symbolic_searchlist address, or some other map's
to its own l_symbolic_searchlist address, or some map's
l_searchlist address. */
if (imap->l_scope[cnt] != &imap->l_symbolic_searchlist)
{
@@ -347,6 +347,21 @@ _dl_close (void *_map)
}
}
}
else
{
unsigned int cnt = 0;
while (imap->l_scope[cnt] != NULL)
{
if (imap->l_scope[cnt] == &map->l_searchlist)
{
while ((imap->l_scope[cnt] = imap->l_scope[cnt + 1])
!= NULL)
++cnt;
break;
}
++cnt;
}
}
/* The loader is gone, so mark the object as not having one.
Note: l_idx != -1 -> object will be removed. */