summaryrefslogtreecommitdiff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-05-31 13:23:14 +0000
committerRoland McGrath <roland@gnu.org>1995-05-31 13:23:14 +0000
commita1a9d215963c548aef245cacd8efa944de69503b (patch)
treeff96263310f3c2e3c1f90d4ec8b332b7af028d84 /elf/rtld.c
parent4174072112e4e2b43cc65a5093a433b4270aed49 (diff)
Tue May 30 15:52:32 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* mach/Makefile (server-interfaces): Removed notify and device_reply. For shlibs with eager binding, libmachuser.so must not refer to any functions not defined in libc.
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 85f258a948..409b9705d8 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -93,6 +93,8 @@ _dl_start (void *arg)
void _start (void);
+static int rtld_command; /* Nonzero if we were run directly. */
+
static void
dl_main (const Elf32_Phdr *phdr,
Elf32_Word phent,
@@ -138,6 +140,7 @@ file you run. This is mostly of use for maintainers to test new versions\n\
of this helper program; chances are you did not intend to run this program.\n"
);
+ rtld_command = 1;
interpreter_name = _dl_argv[0];
--_dl_argc;
++_dl_argv;
@@ -164,7 +167,7 @@ of this helper program; chances are you did not intend to run this program.\n"
case PT_DYNAMIC:
/* This tells us where to find the dynamic section,
which tells us everything we need to do. */
- l->l_ld = (void *) ph->p_vaddr;
+ l->l_ld = (void *) l->l_addr + ph->p_vaddr;
break;
case PT_INTERP:
/* This "interpreter segment" was used by the program loader to
@@ -173,7 +176,7 @@ of this helper program; chances are you did not intend to run this program.\n"
dlopen call or DT_NEEDED entry, for something that wants to link
against the dynamic linker as a shared library, will know that
the shared object is already loaded. */
- interpreter_name = (void *) ph->p_vaddr;
+ interpreter_name = (void *) l->l_addr + ph->p_vaddr;
break;
}
assert (interpreter_name); /* How else did we get here? */
@@ -220,7 +223,7 @@ of this helper program; chances are you did not intend to run this program.\n"
l->l_next->l_prev = l->l_prev;
}
- lazy = _dl_secure || *(getenv ("LD_BIND_NOW") ?: "");
+ lazy = !_dl_secure && *(getenv ("LD_BIND_NOW") ?: "") == '\0';
/* Now we have all the objects loaded. Relocate them all.
We do this in reverse order so that copy relocs of earlier