summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-07-21 05:07:54 +0000
committerUlrich Drepper <drepper@redhat.com>2000-07-21 05:07:54 +0000
commit266bb989e0a4b40e369eff177a59754655059fd8 (patch)
tree53702c95a862a9fc6f11f40ae81e4ccc5a44ac79 /elf
parent2cb8cefbd42def9331fde5d8101b3f208440b60c (diff)
downloadglibc-266bb989e0a4b40e369eff177a59754655059fd8.tar.gz
Update.
* elf/dl-load.c (_dl_map_object): Implement handling of DF_1_NODEFLIB.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c41
1 files changed, 34 insertions, 7 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 1e5ad5073d..5e714af483 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1467,21 +1467,48 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
const char *cached = _dl_load_cache_lookup (name);
if (cached)
{
- fd = __open (cached, O_RDONLY);
- if (fd != -1)
+ /* If the loader has the DF_1_NODEFLIB flag set we must not
+ use a cache entry from any of these directories. */
+ if (__builtin_expect (loader->l_flags_1 & DF_1_NODEFLIB, 0))
+ {
+ const char *dirp = system_dirs;
+ int cnt = 0;
+
+ do
+ {
+ if (memcmp (cached, dirp, system_dirs_len[cnt]) == 0)
+ {
+ /* The prefix matches. Don't use the entry. */
+ cached = NULL;
+ break;
+ }
+
+ dirp += system_dirs_len[cnt] + 1;
+ ++cnt;
+ }
+ while (cnt < (sizeof (system_dirs_len)
+ / sizeof (system_dirs_len[0])));
+ }
+
+ if (cached)
{
- realname = local_strdup (cached);
- if (realname == NULL)
+ fd = __open (cached, O_RDONLY);
+ if (fd != -1)
{
- __close (fd);
- fd = -1;
+ realname = local_strdup (cached);
+ if (realname == NULL)
+ {
+ __close (fd);
+ fd = -1;
+ }
}
}
}
}
/* Finally, try the default path. */
- if (fd == -1)
+ if (fd == -1
+ && __builtin_expect (!(loader->l_flags_1 & DF_1_NODEFLIB), 1))
fd = open_path (name, namelen, preloaded, &rtld_search_dirs,
&realname);