diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-08-16 06:30:08 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-08-16 06:30:08 +0000 |
commit | 1ebba33ece5a998d3d79fa14adca3ae7985cbff5 (patch) | |
tree | c5e37a6ed7614a055548537d58d8ab58b94b3f9f | |
parent | 74e61bb4e5fe0691d497f04cf71fbd4717da6db2 (diff) | |
download | glibc-1ebba33ece5a998d3d79fa14adca3ae7985cbff5.tar glibc-1ebba33ece5a998d3d79fa14adca3ae7985cbff5.tar.gz glibc-1ebba33ece5a998d3d79fa14adca3ae7985cbff5.tar.bz2 glibc-1ebba33ece5a998d3d79fa14adca3ae7985cbff5.zip |
Update.
2000-08-15 Ulrich Drepper <drepper@redhat.com>
* sysdeps/generic/ldsodefs.h: Declare _nl_nloaded.
* elf/Versions [ld] (GLIBC_2.2): Add _nl_nloaded.
* elf/dl-support.c: Define _nl_nloaded.
* elf/rtld.c: Likewise. Increment _nl_nloaded for rtld itself.
* elf/dl-object.c (_dl_new_object): Increment _nl_nloaded after adding
object to global list.
* elf/dl-close.c (_dl_close): Decrement _nl_nloaded after removing
from _dl_loaded list.
* elf/dl-load.c (_dl_map_object_from_fd): Likewise.
* elf/dl-fini.c (_dl_fini): Use _nl_nloaded instead of computing the
number here.
* sysdeps/i386/fpu/fedisblxcpt.c (fedisableexcept): Mask, not
unmask, exceptions.
* sysdeps/i386/fpu/feenablxcpt.c (feenableexcept): Unmask, not mask,
exceptions.
Reported by Harvey J. Stein <hjstein@bfr.co.il>.
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | elf/Versions | 2 | ||||
-rw-r--r-- | elf/dl-close.c | 1 | ||||
-rw-r--r-- | elf/dl-fini.c | 21 | ||||
-rw-r--r-- | elf/dl-load.c | 3 | ||||
-rw-r--r-- | elf/dl-object.c | 1 | ||||
-rw-r--r-- | elf/dl-support.c | 2 | ||||
-rw-r--r-- | elf/rtld.c | 3 |
8 files changed, 40 insertions, 13 deletions
@@ -1,3 +1,23 @@ +2000-08-15 Ulrich Drepper <drepper@redhat.com> + + * sysdeps/generic/ldsodefs.h: Declare _nl_nloaded. + * elf/Versions [ld] (GLIBC_2.2): Add _nl_nloaded. + * elf/dl-support.c: Define _nl_nloaded. + * elf/rtld.c: Likewise. Increment _nl_nloaded for rtld itself. + * elf/dl-object.c (_dl_new_object): Increment _nl_nloaded after adding + object to global list. + * elf/dl-close.c (_dl_close): Decrement _nl_nloaded after removing + from _dl_loaded list. + * elf/dl-load.c (_dl_map_object_from_fd): Likewise. + * elf/dl-fini.c (_dl_fini): Use _nl_nloaded instead of computing the + number here. + + * sysdeps/i386/fpu/fedisblxcpt.c (fedisableexcept): Mask, not + unmask, exceptions. + * sysdeps/i386/fpu/feenablxcpt.c (feenableexcept): Unmask, not mask, + exceptions. + Reported by Harvey J. Stein <hjstein@bfr.co.il>. + 2000-08-16 Andreas Jaeger <aj@suse.de> * elf/elf.h (EM_X8664): Add official x86-64 specific value. diff --git a/elf/Versions b/elf/Versions index bb8b5f5982..789774bd90 100644 --- a/elf/Versions +++ b/elf/Versions @@ -52,7 +52,7 @@ ld { _dl_dst_count; _dl_dst_substitute; } GLIBC_2.2 { - _dl_init; _dl_load_lock; _dl_argv; + _dl_init; _dl_load_lock; _dl_argv; _dl_nloaded; # this is defined in ld.so and overridden by libc _dl_init_first; diff --git a/elf/dl-close.c b/elf/dl-close.c index 6bdedd1b80..cbbb2ae298 100644 --- a/elf/dl-close.c +++ b/elf/dl-close.c @@ -166,6 +166,7 @@ _dl_close (void *_map) else _dl_loaded = imap->l_next; #endif + --_dl_nloaded; if (imap->l_next) imap->l_next->l_prev = imap->l_prev; diff --git a/elf/dl-fini.c b/elf/dl-fini.c index 9b103aeb7e..c7d4ebc86a 100644 --- a/elf/dl-fini.c +++ b/elf/dl-fini.c @@ -42,29 +42,28 @@ _dl_fini (void) using `dlopen' there are possibly several other modules with its dependencies to be taken into account. Therefore we have to start determining the order of the modules once again from the beginning. */ - unsigned int nloaded = 0; unsigned int i; struct link_map *l; struct link_map **maps; - /* First count how many objects are there. */ - for (l = _dl_loaded; l != NULL; l = l->l_next) - ++nloaded; - /* XXX Could it be (in static binaries) that there is no object loaded? */ - assert (nloaded > 0); + assert (_dl_nloaded > 0); /* Now we can allocate an array to hold all the pointers and copy the pointers in. */ - maps = (struct link_map **) alloca (nloaded * sizeof (struct link_map *)); - for (l = _dl_loaded, nloaded = 0; l != NULL; l = l->l_next) + maps = (struct link_map **) alloca (_dl_nloaded + * sizeof (struct link_map *)); + for (l = _dl_loaded, i = 0; l != NULL; l = l->l_next) { - maps[nloaded++] = l; + assert (i < _dl_nloaded); + + maps[i++] = l; /* Bump l_opencount of all objects so that they are not dlclose()ed from underneath us. */ ++l->l_opencount; } + assert (i == _dl_nloaded); /* Now we have to do the sorting. */ for (l = _dl_loaded->l_next; l != NULL; l = l->l_next) @@ -78,7 +77,7 @@ _dl_fini (void) /* Find all object for which the current one is a dependency and move the found object (if necessary) in front. */ - for (k = j + 1; k < nloaded; ++k) + for (k = j + 1; k < _dl_nloaded; ++k) { struct link_map **runp; @@ -129,7 +128,7 @@ _dl_fini (void) /* `maps' now contains the objects in the right order. Now call the destructors. We have to process this array from the front. */ - for (i = 0; i < nloaded; ++i) + for (i = 0; i < _dl_nloaded; ++i) { l = maps[i]; diff --git a/elf/dl-load.c b/elf/dl-load.c index a1e4e5a47f..ffaca6e55d 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1105,13 +1105,14 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname, { /* Remove from the module list. */ assert (l->l_next == NULL); -#ifdef SHARED +#ifndef SHARED if (l->l_prev == NULL) /* No other module loaded. */ _dl_loaded = NULL; else #endif l->l_prev->l_next = NULL; + --_dl_nloaded; /* We are not supposed to load this object. Free all resources. */ __munmap ((void *) l->l_map_start, l->l_map_end - l->l_map_start); diff --git a/elf/dl-object.c b/elf/dl-object.c index 986929ce20..eab8840985 100644 --- a/elf/dl-object.c +++ b/elf/dl-object.c @@ -67,6 +67,7 @@ _dl_new_object (char *realname, const char *libname, int type, } else _dl_loaded = new; + ++_dl_nloaded; /* This is our local scope. */ if (loader != NULL) { diff --git a/elf/dl-support.c b/elf/dl-support.c index ec0bbb22bb..d2c8738043 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -72,6 +72,8 @@ int _dl_bind_not; /* Initially empty list of loaded objects. */ struct link_map *_dl_loaded; +/* Number of object in the _dl_loaded list. */ +unsigned int _dl_nloaded; /* Fake scope. In dynamically linked binaries this is the scope of the main application but here we don't have something like this. So diff --git a/elf/rtld.c b/elf/rtld.c index 1d144c536e..9a444fcfd9 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -101,6 +101,8 @@ int _dl_bind_not; /* This is a pointer to the map for the main object and through it to all loaded objects. */ struct link_map *_dl_loaded; +/* Number of object in the _dl_loaded list. */ +unsigned int _dl_nloaded; /* Pointer to the l_searchlist element of the link map of the main object. */ struct r_scope_elem *_dl_main_searchlist; /* Copy of the content of `_dl_main_searchlist'. */ @@ -670,6 +672,7 @@ of this helper program; chances are you did not intend to run this program.\n\ _dl_rtld_map.l_type = lt_library; _dl_loaded->l_next = &_dl_rtld_map; _dl_rtld_map.l_prev = _dl_loaded; + ++_dl_nloaded; /* We have two ways to specify objects to preload: via environment variable and via the file /etc/ld.so.preload. The latter can also |