summaryrefslogtreecommitdiff
path: root/ldso/libdl
diff options
context:
space:
mode:
authorLeonid Lisovskiy <lly.dev@gmail.com>2016-01-26 20:12:58 +0300
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-01-31 17:41:21 +0100
commit2f389d46df6a9634589554708e2a7ea6ca901b86 (patch)
treecadff935def6f64bb936a2f2866d737d0f567456 /ldso/libdl
parentd6d36639c6a5dffbcdb77e947aafd1e858bbb714 (diff)
ldso: Use single rtld_flags interpretation through all the calls
Implement single rtld_flags interpretation through all the do_dlopen()/_dl_load_shared_library()/_dl_load_elf_shared_library() calls chain. This adds the ability to use the flags, passed to dlopen(), in all underlaying functions and implement rtld_flags inheritance. Saves a few bytes code. Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Diffstat (limited to 'ldso/libdl')
-rw-r--r--ldso/libdl/libdl.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index 08619bc37..42a09a8bb 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -59,8 +59,6 @@ extern struct link_map *_dl_update_slotinfo(unsigned long int req_modid);
* and use a pile of symbols from ldso... */
#include <dl-elf.h>
#if 0
-extern struct elf_resolve * _dl_load_shared_library(unsigned, struct dyn_elf **,
- struct elf_resolve *, char *, int);
extern int _dl_fixup(struct dyn_elf *rpnt, struct r_scope_elem *scope, int lazy);
extern void _dl_protect_relro(struct elf_resolve * tpnt);
#endif
@@ -385,7 +383,7 @@ static void *do_dlopen(const char *libname, int flag, ElfW(Addr) from)
_dl_if_debug_print("Trying to dlopen '%s', RTLD_GLOBAL:%d RTLD_NOW:%d\n",
(char*)libname, (flag & RTLD_GLOBAL ? 1:0), (now_flag & RTLD_NOW ? 1:0));
- tpnt = _dl_load_shared_library((flag & RTLD_NOLOAD) ? DL_RESOLVE_NOLOAD : 0,
+ tpnt = _dl_load_shared_library(flag & (RTLD_NOLOAD | RTLD_GLOBAL | RTLD_NODELETE),
&rpnt, tfrom, (char*)libname, 0);
if (tpnt == NULL) {
_dl_unmap_cache();
@@ -394,7 +392,6 @@ static void *do_dlopen(const char *libname, int flag, ElfW(Addr) from)
dyn_chain = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
memset(dyn_chain, 0, sizeof(struct dyn_elf));
dyn_chain->dyn = tpnt;
- tpnt->rtld_flags |= (flag & (RTLD_GLOBAL|RTLD_NODELETE));
dyn_chain->next_handle = _dl_handles;
_dl_handles = dyn_ptr = dyn_chain;
@@ -435,12 +432,11 @@ static void *do_dlopen(const char *libname, int flag, ElfW(Addr) from)
dpnt->d_un.d_val);
_dl_if_debug_print("Trying to load '%s', needed by '%s'\n",
lpntstr, runp->tpnt->libname);
- tpnt1 = _dl_load_shared_library(0, &rpnt, runp->tpnt, lpntstr, 0);
+ tpnt1 = _dl_load_shared_library(flag & (RTLD_GLOBAL | RTLD_NODELETE),
+ &rpnt, runp->tpnt, lpntstr, 0);
if (!tpnt1)
goto oops;
- tpnt1->rtld_flags |= (flag & (RTLD_GLOBAL|RTLD_NODELETE));
-
/* This list is for dlsym() and relocation */
dyn_ptr->next = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
memset (dyn_ptr->next, 0, sizeof (struct dyn_elf));