mirror of git://sourceware.org/git/glibc.git
Update.
2000-04-03 Ulrich Drepper <drepper@redhat.com> * elf/dl-load.c (_dl_init_paths): Use (void*) -1 to signal non-existing RUNPATH, RPATH, and LD_LIBRARY_PATH. (open_path): Change type of fourth parameter. Make pointer to array of pointers. Create variable dirs with original type. Track whether any directory for the object exists and if not, change *DIRSP to (void*) -1 to signal there is no such search path. (_dl_map_object): Change all calls of open_path. Rewrite decompose_rpath calls.
This commit is contained in:
parent
42ba2c1158
commit
152e7964d6
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2000-04-03 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* elf/dl-load.c (_dl_init_paths): Use (void*) -1 to signal non-existing
|
||||||
|
RUNPATH, RPATH, and LD_LIBRARY_PATH.
|
||||||
|
(open_path): Change type of fourth parameter. Make pointer to array
|
||||||
|
of pointers. Create variable dirs with original type.
|
||||||
|
Track whether any directory for the object exists and if not,
|
||||||
|
change *DIRSP to (void*) -1 to signal there is no such search path.
|
||||||
|
(_dl_map_object): Change all calls of open_path.
|
||||||
|
Rewrite decompose_rpath calls.
|
||||||
|
|
||||||
2000-03-31 Andreas Schwab <schwab@suse.de>
|
2000-03-31 Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
* string/strfry.c: Declare STATE as array of char instead of int
|
* string/strfry.c: Declare STATE as array of char instead of int
|
||||||
|
|
|
@ -596,11 +596,11 @@ _dl_init_paths (const char *llp)
|
||||||
l, "RUNPATH");
|
l, "RUNPATH");
|
||||||
|
|
||||||
/* The RPATH is ignored. */
|
/* The RPATH is ignored. */
|
||||||
l->l_rpath_dirs = NULL;
|
l->l_rpath_dirs = (void *) -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
l->l_runpath_dirs = NULL;
|
l->l_runpath_dirs = (void *) -1;
|
||||||
|
|
||||||
if (l->l_info[DT_RPATH])
|
if (l->l_info[DT_RPATH])
|
||||||
/* Allocate room for the search path and fill in information
|
/* Allocate room for the search path and fill in information
|
||||||
|
@ -610,7 +610,7 @@ _dl_init_paths (const char *llp)
|
||||||
+ l->l_info[DT_RPATH]->d_un.d_val),
|
+ l->l_info[DT_RPATH]->d_un.d_val),
|
||||||
l, "RPATH");
|
l, "RPATH");
|
||||||
else
|
else
|
||||||
l->l_rpath_dirs = NULL;
|
l->l_rpath_dirs = (void *) -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* SHARED */
|
#endif /* SHARED */
|
||||||
|
@ -639,6 +639,8 @@ _dl_init_paths (const char *llp)
|
||||||
(void) fillin_rpath (local_strdup (llp), env_path_list, ":;",
|
(void) fillin_rpath (local_strdup (llp), env_path_list, ":;",
|
||||||
__libc_enable_secure, "LD_LIBRARY_PATH", NULL);
|
__libc_enable_secure, "LD_LIBRARY_PATH", NULL);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
env_path_list = (void *) -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1159,18 +1161,14 @@ print_search_path (struct r_search_path_elem **list,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
open_path (const char *name, size_t namelen, int preloaded,
|
open_path (const char *name, size_t namelen, int preloaded,
|
||||||
struct r_search_path_elem **dirs,
|
struct r_search_path_elem ***dirsp,
|
||||||
char **realname)
|
char **realname)
|
||||||
{
|
{
|
||||||
|
struct r_search_path_elem **dirs = *dirsp;
|
||||||
char *buf;
|
char *buf;
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
const char *current_what = NULL;
|
const char *current_what = NULL;
|
||||||
|
int any = 0;
|
||||||
if (dirs == NULL || *dirs == NULL)
|
|
||||||
{
|
|
||||||
__set_errno (ENOENT);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = alloca (max_dirnamelen + max_capstrlen + namelen);
|
buf = alloca (max_dirnamelen + max_capstrlen + namelen);
|
||||||
do
|
do
|
||||||
|
@ -1228,6 +1226,9 @@ open_path (const char *name, size_t namelen, int preloaded,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Remember whether we found any existing directory. */
|
||||||
|
any |= this_dir->status[cnt] == existing;
|
||||||
|
|
||||||
if (fd != -1 && preloaded && __libc_enable_secure)
|
if (fd != -1 && preloaded && __libc_enable_secure)
|
||||||
{
|
{
|
||||||
/* This is an extra security effort to make sure nobody can
|
/* This is an extra security effort to make sure nobody can
|
||||||
|
@ -1272,6 +1273,13 @@ open_path (const char *name, size_t namelen, int preloaded,
|
||||||
}
|
}
|
||||||
while (*++dirs != NULL);
|
while (*++dirs != NULL);
|
||||||
|
|
||||||
|
/* Remove the whole path if none of the directories exists. */
|
||||||
|
if (! any)
|
||||||
|
{
|
||||||
|
free (*dirsp);
|
||||||
|
*dirsp = (void *) -1;
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1340,19 +1348,28 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
|
||||||
/* First try the DT_RPATH of the dependent object that caused NAME
|
/* First try the DT_RPATH of the dependent object that caused NAME
|
||||||
to be loaded. Then that object's dependent, and on up. */
|
to be loaded. Then that object's dependent, and on up. */
|
||||||
for (l = loader; fd == -1 && l; l = l->l_loader)
|
for (l = loader; fd == -1 && l; l = l->l_loader)
|
||||||
if (l->l_info[DT_RPATH])
|
|
||||||
{
|
{
|
||||||
/* Make sure the cache information is available. */
|
|
||||||
if (l->l_rpath_dirs == NULL)
|
if (l->l_rpath_dirs == NULL)
|
||||||
{
|
{
|
||||||
|
if (l->l_info[DT_RPATH] == NULL)
|
||||||
|
/* There is no path. */
|
||||||
|
l->l_rpath_dirs = (void *) -1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Make sure the cache information is available. */
|
||||||
size_t ptrval = (D_PTR (l, l_info[DT_STRTAB])
|
size_t ptrval = (D_PTR (l, l_info[DT_STRTAB])
|
||||||
+ l->l_info[DT_RPATH]->d_un.d_val);
|
+ l->l_info[DT_RPATH]->d_un.d_val);
|
||||||
l->l_rpath_dirs =
|
l->l_rpath_dirs =
|
||||||
decompose_rpath ((const char *) ptrval, l, "RPATH");
|
decompose_rpath ((const char *) ptrval, l,
|
||||||
}
|
"RPATH");
|
||||||
|
|
||||||
if (l->l_rpath_dirs != NULL)
|
if (l->l_rpath_dirs != (void *) -1)
|
||||||
fd = open_path (name, namelen, preloaded, l->l_rpath_dirs,
|
fd = open_path (name, namelen, preloaded,
|
||||||
|
&l->l_rpath_dirs, &realname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (l->l_rpath_dirs != (void *) -1)
|
||||||
|
fd = open_path (name, namelen, preloaded, &l->l_rpath_dirs,
|
||||||
&realname);
|
&realname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1360,30 +1377,39 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
|
||||||
itself. */
|
itself. */
|
||||||
l = _dl_loaded;
|
l = _dl_loaded;
|
||||||
if (fd == -1 && l && l->l_type != lt_loaded && l != loader
|
if (fd == -1 && l && l->l_type != lt_loaded && l != loader
|
||||||
&& l->l_rpath_dirs != NULL)
|
&& l->l_rpath_dirs != (void *) -1)
|
||||||
fd = open_path (name, namelen, preloaded, l->l_rpath_dirs,
|
fd = open_path (name, namelen, preloaded, &l->l_rpath_dirs,
|
||||||
&realname);
|
&realname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try the LD_LIBRARY_PATH environment variable. */
|
/* Try the LD_LIBRARY_PATH environment variable. */
|
||||||
if (fd == -1 && env_path_list != NULL)
|
if (fd == -1 && env_path_list != (void *) -1)
|
||||||
fd = open_path (name, namelen, preloaded, env_path_list, &realname);
|
fd = open_path (name, namelen, preloaded, &env_path_list, &realname);
|
||||||
|
|
||||||
/* Look at the RUNPATH informaiton for this binary. */
|
/* Look at the RUNPATH informaiton for this binary. */
|
||||||
if (loader != NULL && loader->l_info[DT_RUNPATH])
|
if (loader != NULL && loader->l_runpath_dirs != (void *) -1)
|
||||||
{
|
{
|
||||||
/* Make sure the cache information is available. */
|
|
||||||
if (loader->l_runpath_dirs == NULL)
|
if (loader->l_runpath_dirs == NULL)
|
||||||
{
|
{
|
||||||
|
if (loader->l_info[DT_RUNPATH] == NULL)
|
||||||
|
/* No RUNPATH. */
|
||||||
|
loader->l_runpath_dirs = (void *) -1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Make sure the cache information is available. */
|
||||||
size_t ptrval = (D_PTR (loader, l_info[DT_STRTAB])
|
size_t ptrval = (D_PTR (loader, l_info[DT_STRTAB])
|
||||||
+ loader->l_info[DT_RUNPATH]->d_un.d_val);
|
+ loader->l_info[DT_RUNPATH]->d_un.d_val);
|
||||||
loader->l_runpath_dirs =
|
loader->l_runpath_dirs =
|
||||||
decompose_rpath ((const char *) ptrval, loader, "RUNPATH");
|
decompose_rpath ((const char *) ptrval, loader, "RUNPATH");
|
||||||
}
|
|
||||||
|
|
||||||
if (loader->l_runpath_dirs != NULL)
|
if (loader->l_runpath_dirs != (void *) -1)
|
||||||
fd = open_path (name, namelen, preloaded, loader->l_runpath_dirs,
|
fd = open_path (name, namelen, preloaded,
|
||||||
&realname);
|
&loader->l_runpath_dirs, &realname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (loader->l_runpath_dirs != (void *) -1)
|
||||||
|
fd = open_path (name, namelen, preloaded,
|
||||||
|
&loader->l_runpath_dirs, &realname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
|
@ -1409,7 +1435,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
|
||||||
|
|
||||||
/* Finally, try the default path. */
|
/* Finally, try the default path. */
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
fd = open_path (name, namelen, preloaded, rtld_search_dirs, &realname);
|
fd = open_path (name, namelen, preloaded, &rtld_search_dirs,
|
||||||
|
&realname);
|
||||||
|
|
||||||
/* Add another newline when we a tracing the library loading. */
|
/* Add another newline when we a tracing the library loading. */
|
||||||
if (__builtin_expect (_dl_debug_libs, 0))
|
if (__builtin_expect (_dl_debug_libs, 0))
|
||||||
|
|
Loading…
Reference in New Issue