Rather than using the #define for path names, indirect through a char *
variable that could change for different executable types detected.
This commit is contained in:
parent
0d0aa50ab4
commit
5ad4c45cb8
@ -68,7 +68,7 @@ lm_init(char *libmap_override)
|
||||
dbg("lm_init(\"%s\")", libmap_override);
|
||||
TAILQ_INIT(&lmp_head);
|
||||
|
||||
lmc_parse_file(_PATH_LIBMAP_CONF);
|
||||
lmc_parse_file(ld_path_libmap_conf);
|
||||
|
||||
if (libmap_override) {
|
||||
/*
|
||||
|
@ -61,4 +61,10 @@
|
||||
#define LD_ "LD_"
|
||||
#endif
|
||||
|
||||
extern char *ld_path_elf_hints;
|
||||
extern char *ld_path_libmap_conf;
|
||||
extern char *ld_path_rtld;
|
||||
extern char *ld_standard_library_path;
|
||||
extern char *ld_env_prefix;
|
||||
|
||||
#endif /* PATHS_H */
|
||||
|
@ -254,6 +254,15 @@ int tls_max_index = 1; /* Largest module index allocated */
|
||||
|
||||
bool ld_library_path_rpath = false;
|
||||
|
||||
/*
|
||||
* Globals for path names, and such
|
||||
*/
|
||||
char *ld_path_elf_hints = _PATH_ELF_HINTS;
|
||||
char *ld_path_libmap_conf = _PATH_LIBMAP_CONF;
|
||||
char *ld_path_rtld = _PATH_RTLD;
|
||||
char *ld_standard_library_path = STANDARD_LIBRARY_PATH;
|
||||
char *ld_env_prefix = LD_;
|
||||
|
||||
/*
|
||||
* Fill in a DoneList with an allocation large enough to hold all of
|
||||
* the currently-loaded objects. Keep this as a macro since it calls
|
||||
@ -449,7 +458,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
||||
ld_utrace = getenv(LD_ "UTRACE");
|
||||
|
||||
if ((ld_elf_hints_path == NULL) || strlen(ld_elf_hints_path) == 0)
|
||||
ld_elf_hints_path = _PATH_ELF_HINTS;
|
||||
ld_elf_hints_path = ld_path_elf_hints;
|
||||
|
||||
if (ld_debug != NULL && *ld_debug != '\0')
|
||||
debug = 1;
|
||||
@ -1506,7 +1515,7 @@ find_library(const char *xname, const Obj_Entry *refobj, int *fdp)
|
||||
(pathname = search_library_path(name, refobj->rpath)) != NULL) ||
|
||||
(pathname = search_library_pathfds(name, ld_library_dirs, fdp)) != NULL ||
|
||||
(pathname = search_library_path(name, gethints(false))) != NULL ||
|
||||
(pathname = search_library_path(name, STANDARD_LIBRARY_PATH)) != NULL)
|
||||
(pathname = search_library_path(name, ld_standard_library_path)) != NULL)
|
||||
return (pathname);
|
||||
} else {
|
||||
nodeflib = objgiven ? refobj->z_nodeflib : false;
|
||||
@ -1520,7 +1529,7 @@ find_library(const char *xname, const Obj_Entry *refobj, int *fdp)
|
||||
(pathname = search_library_pathfds(name, ld_library_dirs, fdp)) != NULL ||
|
||||
(pathname = search_library_path(name, gethints(nodeflib))) != NULL ||
|
||||
(objgiven && !nodeflib &&
|
||||
(pathname = search_library_path(name, STANDARD_LIBRARY_PATH)) != NULL))
|
||||
(pathname = search_library_path(name, ld_standard_library_path)) != NULL))
|
||||
return (pathname);
|
||||
}
|
||||
|
||||
@ -1690,7 +1699,7 @@ gethints(bool nostdlib)
|
||||
hargs.request = RTLD_DI_SERINFOSIZE;
|
||||
hargs.serinfo = &hmeta;
|
||||
|
||||
path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &sargs);
|
||||
path_enumerate(ld_standard_library_path, fill_search_info, &sargs);
|
||||
path_enumerate(p, fill_search_info, &hargs);
|
||||
|
||||
SLPinfo = xmalloc(smeta.dls_size);
|
||||
@ -1709,7 +1718,7 @@ gethints(bool nostdlib)
|
||||
hargs.serpath = &hintinfo->dls_serpath[0];
|
||||
hargs.strspace = (char *)&hintinfo->dls_serpath[hmeta.dls_cnt];
|
||||
|
||||
path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &sargs);
|
||||
path_enumerate(ld_standard_library_path, fill_search_info, &sargs);
|
||||
path_enumerate(p, fill_search_info, &hargs);
|
||||
|
||||
/*
|
||||
@ -1887,7 +1896,7 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo **aux_info)
|
||||
digest_dynamic2(&obj_rtld, dyn_rpath, dyn_soname, dyn_runpath);
|
||||
|
||||
/* Replace the path with a dynamically allocated copy. */
|
||||
obj_rtld.path = xstrdup(_PATH_RTLD);
|
||||
obj_rtld.path = xstrdup(ld_path_rtld);
|
||||
|
||||
r_debug.r_brk = r_debug_state;
|
||||
r_debug.r_state = RT_CONSISTENT;
|
||||
@ -3501,7 +3510,7 @@ do_search_info(const Obj_Entry *obj, int request, struct dl_serinfo *info)
|
||||
path_enumerate(obj->runpath, fill_search_info, &args);
|
||||
path_enumerate(gethints(obj->z_nodeflib), fill_search_info, &args);
|
||||
if (!obj->z_nodeflib)
|
||||
path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &args);
|
||||
path_enumerate(ld_standard_library_path, fill_search_info, &args);
|
||||
|
||||
|
||||
if (request == RTLD_DI_SERINFOSIZE) {
|
||||
@ -3539,7 +3548,7 @@ do_search_info(const Obj_Entry *obj, int request, struct dl_serinfo *info)
|
||||
|
||||
args.flags = LA_SER_DEFAULT;
|
||||
if (!obj->z_nodeflib &&
|
||||
path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &args) != NULL)
|
||||
path_enumerate(ld_standard_library_path, fill_search_info, &args) != NULL)
|
||||
return (-1);
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user