mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Use extend_alloca in _dl_map_object_deps.
This commit is contained in:
committed by
Roland McGrath
parent
f4ec483382
commit
02f9c6cfe2
@ -1,3 +1,8 @@
|
|||||||
|
2011-10-31 Paul Pluzhnikov <ppluzhnikov@google.com>
|
||||||
|
|
||||||
|
* elf/dl-deps.c (_dl_map_object_deps): Reuse alloca space to reduce
|
||||||
|
stack usage.
|
||||||
|
|
||||||
2011-10-31 Ulrich Drepper <drepper@gmail.com>
|
2011-10-31 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
[BZ #13367]
|
[BZ #13367]
|
||||||
|
@ -188,6 +188,10 @@ _dl_map_object_deps (struct link_map *map,
|
|||||||
/* Pointer to last unique object. */
|
/* Pointer to last unique object. */
|
||||||
tail = &known[nlist - 1];
|
tail = &known[nlist - 1];
|
||||||
|
|
||||||
|
/* No alloca'd space yet. */
|
||||||
|
struct link_map **needed_space = NULL;
|
||||||
|
size_t needed_space_bytes = 0;
|
||||||
|
|
||||||
/* Process each element of the search list, loading each of its
|
/* Process each element of the search list, loading each of its
|
||||||
auxiliary objects and immediate dependencies. Auxiliary objects
|
auxiliary objects and immediate dependencies. Auxiliary objects
|
||||||
will be added in the list before the object itself and
|
will be added in the list before the object itself and
|
||||||
@ -216,8 +220,19 @@ _dl_map_object_deps (struct link_map *map,
|
|||||||
dependencies of this object. */
|
dependencies of this object. */
|
||||||
if (l->l_searchlist.r_list == NULL && l->l_initfini == NULL
|
if (l->l_searchlist.r_list == NULL && l->l_initfini == NULL
|
||||||
&& l != map && l->l_ldnum > 0)
|
&& l != map && l->l_ldnum > 0)
|
||||||
needed = (struct link_map **) alloca (l->l_ldnum
|
{
|
||||||
* sizeof (struct link_map *));
|
/* 16-align so extend_alloca has a chance to re-use the space.
|
||||||
|
Note that extend_alloca is broken for recent versions of GCC
|
||||||
|
on x86: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50938 */
|
||||||
|
size_t new_size
|
||||||
|
= (l->l_ldnum * sizeof (struct link_map *) + 15) & ~15;
|
||||||
|
|
||||||
|
if (new_size > needed_space_bytes)
|
||||||
|
needed_space
|
||||||
|
= extend_alloca (needed_space, needed_space_bytes, new_size);
|
||||||
|
|
||||||
|
needed = needed_space;
|
||||||
|
}
|
||||||
|
|
||||||
if (l->l_info[DT_NEEDED] || l->l_info[AUXTAG] || l->l_info[FILTERTAG])
|
if (l->l_info[DT_NEEDED] || l->l_info[AUXTAG] || l->l_info[FILTERTAG])
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user