diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-03-15 05:32:11 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-03-15 05:32:11 +0000 |
commit | d9cb1a7dad1f2638cdaa12ff8ade54f9c24c64bc (patch) | |
tree | 6cc6cb94f13c173b2d52c0f43fd3a36c967830ab /elf/dl-deps.c | |
parent | 36388ac46a351a923a7690a8b0e88266bab16098 (diff) | |
download | glibc-d9cb1a7dad1f2638cdaa12ff8ade54f9c24c64bc.zip glibc-d9cb1a7dad1f2638cdaa12ff8ade54f9c24c64bc.tar.gz glibc-d9cb1a7dad1f2638cdaa12ff8ade54f9c24c64bc.tar.bz2 |
Update.
* elf/dl-deps.c (_dl_map_object_deps): Change return type and remove
last parameter. Move code to add map to global scope from here...
* elf/dl-open.c (dl_open_worker): ...here.
* elf/ldsodefs.h: Adjust declaration of _dl_map_object_deps.
* elf/rtld.c: Adjust call to _dl_map_object_deps.
Diffstat (limited to 'elf/dl-deps.c')
-rw-r--r-- | elf/dl-deps.c | 86 |
1 files changed, 3 insertions, 83 deletions
diff --git a/elf/dl-deps.c b/elf/dl-deps.c index 68e4921..57d1056 100644 --- a/elf/dl-deps.c +++ b/elf/dl-deps.c @@ -1,5 +1,5 @@ /* Load the dependencies of a mapped object. - Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -131,16 +131,15 @@ struct list __result; }) -unsigned int +void internal_function _dl_map_object_deps (struct link_map *map, struct link_map **preloads, unsigned int npreloads, - int trace_mode, int global_scope) + int trace_mode) { struct list known[1 + npreloads + 1]; struct list *runp, *utail, *dtail; unsigned int nlist, nduplist, i; - unsigned int to_add = 0; inline void preload (struct link_map *map) { @@ -480,83 +479,4 @@ _dl_map_object_deps (struct link_map *map, else map->l_searchlist.r_duplist[cnt++] = runp->map; } - - /* Now that all this succeeded put the objects in the global scope if - this is necessary. We put the original object and all the dependencies - in the global scope. If an object is already loaded and not in the - global scope we promote it. */ - if (global_scope) - { - unsigned int cnt; - struct link_map **new_global; - - /* Count the objects we have to put in the global scope. */ - for (cnt = 0; cnt < nlist; ++cnt) - if (map->l_searchlist.r_list[cnt]->l_global == 0) - ++to_add; - - /* The symbols of the new objects and its dependencies are to be - introduced into the global scope that will be used to resolve - references from other dynamically-loaded objects. - - The global scope is the searchlist in the main link map. We - extend this list if necessary. There is one problem though: - since this structure was allocated very early (before the libc - is loaded) the memory it uses is allocated by the malloc()-stub - in the ld.so. When we come here these functions are not used - anymore. Instead the malloc() implementation of the libc is - used. But this means the block from the main map cannot be used - in an realloc() call. Therefore we allocate a completely new - array the first time we have to add something to the locale scope. */ - - if (_dl_global_scope_alloc == 0) - { - /* This is the first dynamic object given global scope. */ - _dl_global_scope_alloc = _dl_main_searchlist->r_nlist + to_add + 8; - new_global = (struct link_map **) - malloc (_dl_global_scope_alloc * sizeof (struct link_map *)); - if (new_global == NULL) - { - _dl_global_scope_alloc = 0; - nomem: - _dl_signal_error (ENOMEM, map->l_libname->name, - "cannot extend global scope"); - return 0; - } - - /* Copy over the old entries. */ - memcpy (new_global, _dl_main_searchlist->r_list, - (_dl_main_searchlist->r_nlist * sizeof (struct link_map *))); - - _dl_main_searchlist->r_list = new_global; - } - else if (_dl_main_searchlist->r_nlist + to_add > _dl_global_scope_alloc) - { - /* We have to extend the existing array of link maps in the - main map. */ - new_global = (struct link_map **) - realloc (_dl_main_searchlist->r_list, - ((_dl_global_scope_alloc + to_add + 8) - * sizeof (struct link_map *))); - if (new_global == NULL) - goto nomem; - - _dl_global_scope_alloc += to_add + 8; - _dl_main_searchlist->r_list = new_global; - } - - /* Now add the new entries. */ - to_add = 0; - for (cnt = 0; cnt < nlist; ++cnt) - if (map->l_searchlist.r_list[cnt]->l_global == 0) - { - _dl_main_searchlist->r_list[_dl_main_searchlist->r_nlist + to_add] - = map->l_searchlist.r_list[cnt]; - ++to_add; - } - - /* XXX Do we have to add something to r_dupsearchlist??? --drepper */ - } - - return to_add; } |