This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.14-477-g02f9c6c


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  02f9c6cfe286ebd1f39106ae77245c5514ec6919 (commit)
      from  f4ec483382e167469def497422dbb30fee5f5f32 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=02f9c6cfe286ebd1f39106ae77245c5514ec6919

commit 02f9c6cfe286ebd1f39106ae77245c5514ec6919
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date:   Mon Oct 31 16:27:54 2011 -0700

    Use extend_alloca in _dl_map_object_deps.

diff --git a/ChangeLog b/ChangeLog
index 83a64e8..6e247ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
 	[BZ #13367]
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index 95b1088..a1ba3d1 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -188,6 +188,10 @@ _dl_map_object_deps (struct link_map *map,
   /* Pointer to last unique object.  */
   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
      auxiliary objects and immediate dependencies.  Auxiliary objects
      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.  */
       if (l->l_searchlist.r_list == NULL && l->l_initfini == NULL
 	  && 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])
 	{

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog     |    5 +++++
 elf/dl-deps.c |   19 +++++++++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]