summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-08-19 01:07:44 +0000
committerUlrich Drepper <drepper@redhat.com>1996-08-19 01:07:44 +0000
commit39778c6c9e6455303979aca2dc4685bf56cdc9be (patch)
tree9dcdd44d6e7df176f7724ac8ab674a82a947947c /elf
parente9d258b798f0c2e46433d2bd483e4fd47cc00915 (diff)
downloadglibc-39778c6c9e6455303979aca2dc4685bf56cdc9be.tar.gz
update from main archive 960818cvs/libc-960820cvs/libc-960819
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-open.c15
-rw-r--r--elf/rtld.c12
2 files changed, 26 insertions, 1 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 9dda31e761..40b5224725 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -22,6 +22,11 @@ Cambridge, MA 02139, USA. */
#include <stdlib.h>
#include <errno.h>
+
+extern void _dl_start (void); weak_extern (_dl_start)
+
+extern int __libc_multiple_libcs; /* Defined in init-first.c. */
+
size_t _dl_global_scope_alloc;
struct link_map *
@@ -30,7 +35,9 @@ _dl_open (const char *file, int mode)
struct link_map *new, *l;
ElfW(Addr) init;
struct r_debug *r;
-
+ /* To decide whether we are the static libc or not. We must use
+ this variable since gcc would otherwise optimize the test away. */
+ void (*dl_start_ptr) (void) = &_dl_start;
/* Load the named object. */
new = _dl_map_object (NULL, file, lt_loaded);
@@ -131,5 +138,11 @@ _dl_open (const char *file, int mode)
while (init = _dl_init_next (new))
(*(void (*) (void)) init) ();
+ if (dl_start_ptr == NULL)
+ /* We must be the static _dl_open in libc.a because ld.so.1 is not
+ in scope. A static program that has loaded a dynamic object
+ now has competition. */
+ __libc_multiple_libcs = 1;
+
return new;
}
diff --git a/elf/rtld.c b/elf/rtld.c
index b8aa7311ab..9f13124207 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -42,6 +42,15 @@ int _dl_argc;
char **_dl_argv;
const char *_dl_rpath;
+/* Set nonzero during loading and initialization of executable and
+ libraries, cleared before the executable's entry point runs. This
+ must not be initialized to nonzero, because the unused dynamic
+ linker loaded in for libc.so's "ld.so.1" dep will provide the
+ definition seen by libc.so's initializer; that value must be zero,
+ and will be since that dynamic linker's _dl_start and dl_main will
+ never be called. */
+int _dl_starting_up;
+
static void dl_main (const ElfW(Phdr) *phdr,
ElfW(Half) phent,
ElfW(Addr) *user_entry);
@@ -486,6 +495,9 @@ of this helper program; chances are you did not intend to run this program.\n",
_dl_rtld_map.l_info[DT_INIT] = NULL;
}
+ /* We finished the intialization and will start up. */
+ _dl_starting_up = 1;
+
/* Once we return, _dl_sysdep_start will invoke
the DT_INIT functions and then *USER_ENTRY. */
}