summaryrefslogtreecommitdiffstats
path: root/ldso
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-07-07 04:46:29 +0000
committerMike Frysinger <vapier@gentoo.org>2005-07-07 04:46:29 +0000
commitf7437324306a4ed6d81b6e112059684b90773cde (patch)
tree9569e5a6ded9bc5cf6ba03de41b8a34fd98f4511 /ldso
parentce9f1cf9c26bbc4e0cf23c14d8058e1847b1dd8a (diff)
downloaduClibc-alpine-f7437324306a4ed6d81b6e112059684b90773cde.tar.bz2
uClibc-alpine-f7437324306a4ed6d81b6e112059684b90773cde.tar.xz
make RUNPATH/RPATH support configurable
Diffstat (limited to 'ldso')
-rw-r--r--ldso/include/dl-elf.h2
-rw-r--r--ldso/ldso/dl-elf.c13
2 files changed, 11 insertions, 4 deletions
diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h
index 6ecdfddfb..a3e453f58 100644
--- a/ldso/include/dl-elf.h
+++ b/ldso/include/dl-elf.h
@@ -106,10 +106,12 @@ void __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info[], void
dynamic_info[DT_BIND_NOW] = 1;
if (dpnt->d_tag == DT_TEXTREL)
dynamic_info[DT_TEXTREL] = 1;
+#ifdef __LDSO_RUNPATH__
if (dpnt->d_tag == DT_RUNPATH)
dynamic_info[DT_RPATH] = 0;
if (dpnt->d_tag == DT_RPATH && dynamic_info[DT_RUNPATH])
dynamic_info[DT_RPATH] = 0;
+#endif
} else if (dpnt->d_tag < DT_LOPROC) {
if (dpnt->d_tag == DT_RELOCCOUNT)
dynamic_info[DT_RELCONT_IDX] = dpnt->d_un.d_val;
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index d15621ea3..bf0e1bb03 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -255,7 +255,7 @@ unsigned long _dl_internal_error_number;
struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
struct elf_resolve *tpnt, char *full_libname, int __attribute__((unused)) trace_loaded_objects)
{
- char *pnt, *pnt1;
+ char *pnt;
struct elf_resolve *tpnt1;
char *libname;
@@ -269,9 +269,9 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
/* Skip over any initial initial './' and '/' stuff to
* get the short form libname with no path garbage */
- pnt1 = _dl_strrchr(libname, '/');
- if (pnt1) {
- libname = pnt1 + 1;
+ pnt = _dl_strrchr(libname, '/');
+ if (pnt) {
+ libname = pnt + 1;
}
/* Critical step! Weed out duplicates early to avoid
@@ -300,6 +300,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
* The ABI specifies that RPATH is searched before LD_LIBRARY_PATH or
* the default path of /usr/lib. Check in rpath directories.
*/
+#ifdef __LDSO_RUNPATH__
pnt = (tpnt ? (char *) tpnt->dynamic_info[DT_RPATH] : NULL);
if (pnt) {
pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB];
@@ -307,6 +308,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
if ((tpnt1 = search_for_named_library(libname, secure, pnt, rpnt)) != NULL)
return tpnt1;
}
+#endif
/* Check in LD_{ELF_}LIBRARY_PATH, if specified and allowed */
if (_dl_library_path) {
@@ -316,9 +318,11 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
return tpnt1;
}
}
+
/*
* The ABI specifies that RUNPATH is searched after LD_LIBRARY_PATH.
*/
+#ifdef __LDSO_RUNPATH__
pnt = (tpnt ? (char *)tpnt->dynamic_info[DT_RUNPATH] : NULL);
if (pnt) {
pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB];
@@ -326,6 +330,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
if ((tpnt1 = search_for_named_library(libname, secure, pnt, rpnt)) != NULL)
return tpnt1;
}
+#endif
/*
* Where should the cache be searched? There is no such concept in the