summaryrefslogtreecommitdiff
path: root/ldso/libdl/libdl.c
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2004-08-17 13:37:54 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2004-08-17 13:37:54 +0000
commit6d6f3a5c26adcf6b105edfb4b53e97ceee81944c (patch)
treefdf250e80080d49b1e421f7157661033821c5fb7 /ldso/libdl/libdl.c
parentd965f80088fafaacfd33d0b0770724f4fbcbe6e5 (diff)
Let ldso decide if it should relocate itselft a second time. This
is needed if ldso should use libcs malloc whenever possible. Fix RTLD_LAZY propagation to RTLD_NOW relocation when requested by libdl.
Diffstat (limited to 'ldso/libdl/libdl.c')
-rw-r--r--ldso/libdl/libdl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index fd72509d0..d1274e3ff 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -134,6 +134,7 @@ void *dlopen(const char *libname, int flag)
ElfW(Addr) from;
struct elf_resolve *tpnt1;
void (*dl_brk) (void);
+ int now_flag;
/* A bit of sanity checking... */
if (!(flag & (RTLD_LAZY|RTLD_NOW))) {
@@ -188,7 +189,7 @@ void *dlopen(const char *libname, int flag)
dyn_chain = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
_dl_memset(dyn_chain, 0, sizeof(struct dyn_elf));
dyn_chain->dyn = tpnt;
- dyn_chain->flags = flag;
+ tpnt->rtld_flags |= RTLD_GLOBAL;
dyn_chain->next_handle = _dl_handles;
_dl_handles = dyn_ptr = dyn_chain;
@@ -219,6 +220,7 @@ void *dlopen(const char *libname, int flag)
_dl_memset (dyn_ptr->next, 0, sizeof (struct dyn_elf));
dyn_ptr = dyn_ptr->next;
dyn_ptr->dyn = tpnt1;
+ tpnt->rtld_flags |= RTLD_GLOBAL;
if (!tpnt1) {
tpnt1 = _dl_load_shared_library(0, &rpnt, tcurr, lpntstr, 0);
if (!tpnt1)
@@ -254,7 +256,10 @@ void *dlopen(const char *libname, int flag)
* Now we go through and look for REL and RELA records that indicate fixups
* to the GOT tables. We need to do this in reverse order so that COPY
* directives work correctly */
- if (_dl_fixup(dyn_chain, dyn_chain->flags))
+ now_flag = (flag & RTLD_NOW) ? RTLD_NOW : 0;
+ if (getenv("LD_BIND_NOW"))
+ now_flag = RTLD_NOW;
+ if (_dl_fixup(dyn_chain, now_flag))
goto oops;
/* TODO: Should we set the protections of all pages back to R/O now ? */