This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.20-83-gb8c80a7
- From: kcc at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 9 Oct 2014 18:15:31 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.20-83-gb8c80a7
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 b8c80a7e0da28b6e94411ce7d589d2b09674b4b9 (commit)
from 5c0508a318af0a6c8be2a4cb2e3b76896218bf35 (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://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b8c80a7e0da28b6e94411ce7d589d2b09674b4b9
commit b8c80a7e0da28b6e94411ce7d589d2b09674b4b9
Author: Kostya Serebryany <konstantin.s.serebryany@gmail.com>
Date: Thu Oct 9 11:15:24 2014 -0700
remove nested functions from elf/dl-load.c
diff --git a/ChangeLog b/ChangeLog
index d41aba6..f0d3d57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-10-09 Kostya Serebryany <konstantin.s.serebryany@gmail.com>
+
+ * elf/dl-load.c
+ (add_path): New function broken out of _dl_rtld_di_serinfo.
+ (_dl_rtld_di_serinfo): Remove that nested function. Update call sites.
+
2014-10-09 Joseph Myers <joseph@codesourcery.com>
* soft-fp/double.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_D): Use
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 016a99c..fde7137 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -2201,6 +2201,45 @@ _dl_map_object (struct link_map *loader, const char *name,
&stack_end, nsid);
}
+struct add_path_state
+{
+ bool counting;
+ unsigned int idx;
+ Dl_serinfo *si;
+ char *allocptr;
+};
+
+static void
+add_path (struct add_path_state *p, const struct r_search_path_struct *sps,
+ unsigned int flags)
+{
+ if (sps->dirs != (void *) -1)
+ {
+ struct r_search_path_elem **dirs = sps->dirs;
+ do
+ {
+ const struct r_search_path_elem *const r = *dirs++;
+ if (p->counting)
+ {
+ p->si->dls_cnt++;
+ p->si->dls_size += MAX (2, r->dirnamelen);
+ }
+ else
+ {
+ Dl_serpath *const sp = &p->si->dls_serpath[p->idx++];
+ sp->dls_name = p->allocptr;
+ if (r->dirnamelen < 2)
+ *p->allocptr++ = r->dirnamelen ? '/' : '.';
+ else
+ p->allocptr = __mempcpy (p->allocptr,
+ r->dirname, r->dirnamelen - 1);
+ *p->allocptr++ = '\0';
+ sp->dls_flags = flags;
+ }
+ }
+ while (*dirs != NULL);
+ }
+}
void
internal_function
@@ -2212,38 +2251,15 @@ _dl_rtld_di_serinfo (struct link_map *loader, Dl_serinfo *si, bool counting)
si->dls_size = 0;
}
- unsigned int idx = 0;
- char *allocptr = (char *) &si->dls_serpath[si->dls_cnt];
- void add_path (const struct r_search_path_struct *sps, unsigned int flags)
-# define add_path(sps, flags) add_path(sps, 0) /* XXX */
+ struct add_path_state p =
{
- if (sps->dirs != (void *) -1)
- {
- struct r_search_path_elem **dirs = sps->dirs;
- do
- {
- const struct r_search_path_elem *const r = *dirs++;
- if (counting)
- {
- si->dls_cnt++;
- si->dls_size += MAX (2, r->dirnamelen);
- }
- else
- {
- Dl_serpath *const sp = &si->dls_serpath[idx++];
- sp->dls_name = allocptr;
- if (r->dirnamelen < 2)
- *allocptr++ = r->dirnamelen ? '/' : '.';
- else
- allocptr = __mempcpy (allocptr,
- r->dirname, r->dirnamelen - 1);
- *allocptr++ = '\0';
- sp->dls_flags = flags;
- }
- }
- while (*dirs != NULL);
- }
- }
+ .counting = counting,
+ .idx = 0,
+ .si = si,
+ .allocptr = (char *) &si->dls_serpath[si->dls_cnt]
+ };
+
+# define add_path(p, sps, flags) add_path(p, sps, 0) /* XXX */
/* When the object has the RUNPATH information we don't use any RPATHs. */
if (loader->l_info[DT_RUNPATH] == NULL)
@@ -2255,7 +2271,7 @@ _dl_rtld_di_serinfo (struct link_map *loader, Dl_serinfo *si, bool counting)
do
{
if (cache_rpath (l, &l->l_rpath_dirs, DT_RPATH, "RPATH"))
- add_path (&l->l_rpath_dirs, XXX_RPATH);
+ add_path (&p, &l->l_rpath_dirs, XXX_RPATH);
l = l->l_loader;
}
while (l != NULL);
@@ -2266,16 +2282,16 @@ _dl_rtld_di_serinfo (struct link_map *loader, Dl_serinfo *si, bool counting)
l = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
if (l != NULL && l->l_type != lt_loaded && l != loader)
if (cache_rpath (l, &l->l_rpath_dirs, DT_RPATH, "RPATH"))
- add_path (&l->l_rpath_dirs, XXX_RPATH);
+ add_path (&p, &l->l_rpath_dirs, XXX_RPATH);
}
}
/* Try the LD_LIBRARY_PATH environment variable. */
- add_path (&env_path_list, XXX_ENV);
+ add_path (&p, &env_path_list, XXX_ENV);
/* Look at the RUNPATH information for this binary. */
if (cache_rpath (loader, &loader->l_runpath_dirs, DT_RUNPATH, "RUNPATH"))
- add_path (&loader->l_runpath_dirs, XXX_RUNPATH);
+ add_path (&p, &loader->l_runpath_dirs, XXX_RUNPATH);
/* XXX
Here is where ld.so.cache gets checked, but we don't have
@@ -2283,7 +2299,7 @@ _dl_rtld_di_serinfo (struct link_map *loader, Dl_serinfo *si, bool counting)
/* Finally, try the default path. */
if (!(loader->l_flags_1 & DF_1_NODEFLIB))
- add_path (&rtld_search_dirs, XXX_default);
+ add_path (&p, &rtld_search_dirs, XXX_default);
if (counting)
/* Count the struct size before the string area, which we didn't
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 6 ++++
elf/dl-load.c | 88 +++++++++++++++++++++++++++++++++-----------------------
2 files changed, 58 insertions(+), 36 deletions(-)
hooks/post-receive
--
GNU C Library master sources