summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-06-30 09:16:35 +0000
committerJakub Jelinek <jakub@redhat.com>2006-06-30 09:16:35 +0000
commitac7609f7998add41673e8428cf0bc824a40a1361 (patch)
tree016a7dba118f66dc209b26f930cf9dc4354d7d3b /elf
parent2774ea772499f5779e846646824784a44377c69a (diff)
Updated to fedora-glibc-20060630T0858cvs/fedora-glibc-2_4_90-12
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-deps.c12
-rw-r--r--elf/dl-load.c37
2 files changed, 29 insertions, 20 deletions
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index fd3b5243fd..c35cc977fa 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -1,5 +1,5 @@
/* Load the dependencies of a mapped object.
- Copyright (C) 1996-2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996-2003, 2004, 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
@@ -92,7 +92,7 @@ struct list
{
int done; /* Nonzero if this map was processed. */
struct link_map *map; /* The data. */
- struct list *next; /* Elements for normal list. */
+ struct list *next; /* Elements for normal list. */
};
@@ -101,9 +101,9 @@ struct list
({ \
const char *__str = (str); \
const char *__result = __str; \
- size_t __cnt = DL_DST_COUNT(__str, 0); \
+ size_t __dst_cnt = DL_DST_COUNT (__str, 0); \
\
- if (__cnt != 0) \
+ if (__dst_cnt != 0) \
{ \
char *__newp; \
\
@@ -113,9 +113,9 @@ struct list
DST not allowed in SUID/SGID programs")); \
\
__newp = (char *) alloca (DL_DST_REQUIRED (l, __str, strlen (__str), \
- __cnt)); \
+ __dst_cnt)); \
\
- __result = _dl_dst_substitute (l, __str, __newp, 0); \
+ __result = _dl_dst_substitute (l, __str, __newp, 0); \
\
if (*__result == '\0') \
{ \
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 01e1572f51..902ffc4109 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1846,7 +1846,7 @@ open_path (const char *name, size_t namelen, int preloaded,
auditing code. We must try to disturb the program as
little as possible. */
else if (loader == NULL
- || GL(dl_ns)[loader->l_ns]._ns_loaded->l_audit == 0)
+ || GL(dl_ns)[loader->l_ns]._ns_loaded->l_auditing == 0)
{
/* We failed to open machine dependent library. Let's
test whether there is any directory at all. */
@@ -2030,25 +2030,34 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
RPATHs. */
if (loader == NULL || loader->l_info[DT_RUNPATH] == NULL)
{
+ /* This is the executable's map (if there is one). Make sure that
+ we do not look at it twice. */
+ struct link_map *main_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
+ bool did_main_map = false;
+
/* First try the DT_RPATH of the dependent object that caused NAME
to be loaded. Then that object's dependent, and on up. */
- for (l = loader; fd == -1 && l; l = l->l_loader)
+ for (l = loader; l; l = l->l_loader)
if (cache_rpath (l, &l->l_rpath_dirs, DT_RPATH, "RPATH"))
- fd = open_path (name, namelen, preloaded, &l->l_rpath_dirs,
- &realname, &fb, loader, LA_SER_RUNPATH,
- &found_other_class);
+ {
+ fd = open_path (name, namelen, preloaded, &l->l_rpath_dirs,
+ &realname, &fb, loader, LA_SER_RUNPATH,
+ &found_other_class);
+ if (fd != -1)
+ break;
+
+ did_main_map |= l == main_map;
+ }
/* If dynamically linked, try the DT_RPATH of the executable
itself. NB: we do this for lookups in any namespace. */
- if (fd == -1)
- {
- l = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
- if (l && l->l_type != lt_loaded && l != loader
- && cache_rpath (l, &l->l_rpath_dirs, DT_RPATH, "RPATH"))
- fd = open_path (name, namelen, preloaded, &l->l_rpath_dirs,
- &realname, &fb, loader ?: l, LA_SER_RUNPATH,
- &found_other_class);
- }
+ if (fd == -1 && !did_main_map
+ && main_map != NULL && main_map->l_type != lt_loaded
+ && cache_rpath (main_map, &main_map->l_rpath_dirs, DT_RPATH,
+ "RPATH"))
+ fd = open_path (name, namelen, preloaded, &main_map->l_rpath_dirs,
+ &realname, &fb, loader ?: main_map, LA_SER_RUNPATH,
+ &found_other_class);
}
/* Try the LD_LIBRARY_PATH environment variable. */