diff options
author | Ulrich Drepper <drepper@redhat.com> | 1996-08-19 01:07:44 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1996-08-19 01:07:44 +0000 |
commit | 39778c6c9e6455303979aca2dc4685bf56cdc9be (patch) | |
tree | 9dcdd44d6e7df176f7724ac8ab674a82a947947c /elf/dl-open.c | |
parent | e9d258b798f0c2e46433d2bd483e4fd47cc00915 (diff) | |
download | glibc-39778c6c9e6455303979aca2dc4685bf56cdc9be.tar.gz glibc-39778c6c9e6455303979aca2dc4685bf56cdc9be.tar.xz glibc-39778c6c9e6455303979aca2dc4685bf56cdc9be.zip |
update from main archive 960818 cvs/libc-960820 cvs/libc-960819
Diffstat (limited to 'elf/dl-open.c')
-rw-r--r-- | elf/dl-open.c | 15 |
1 files changed, 14 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; } |