Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update.
2001-05-18  Jakub Jelinek  <jakub@redhat.com>

	* elf/dl-lookup.c (PROTECTED): Remove defines.
	(add_dependency): Mark it with internal_function.
	(_dl_do_lookup, _dl_do_lookup_versioned): New functions.
	(_dl_lookup_symbol, _dl_lookup_symbol_skip,
	_dl_lookup_versioned_symbol, _dl_lookup_versioned_symbol_skip): Use
	it if we don't want do_lookup* inlined.

2001-05-18  Jakub Jelinek  <jakub@redhat.com>

	* include/link.h (struct r_scope_elem): Remove r_duplist and
	r_nduplist fields.
	* elf/dl-load.c (_dl_map_object_from_fd): Don't initialize them.
	* elf/dl-lookup.c (_dl_lookup_symbol_skip): Look in r_list, not
	r_duplist.
	(_dl_lookup_versioned_symbol_skip): Likewise.
	* elf/dl-deps.c (struct list): Remove dup field, rename unique to next.
	(_dl_map_object_deps): Don't compute duplicate list.

	* elf/dl-symbol.c: Removed.
	* elf/Makefile (routines): Remove dl-symbol.

2001-05-22  Ulrich Drepper  <drepper@redhat.com>

	* po/el.po: Update from translation team.
	* po/sv.po: Likewise.
  • Loading branch information
Ulrich Drepper committed May 22, 2001
1 parent 2373b30 commit 80d9c5f
Show file tree
Hide file tree
Showing 9 changed files with 5,138 additions and 3,013 deletions.
28 changes: 28 additions & 0 deletions ChangeLog
@@ -1,3 +1,31 @@
2001-05-18 Jakub Jelinek <jakub@redhat.com>

* elf/dl-lookup.c (PROTECTED): Remove defines.
(add_dependency): Mark it with internal_function.
(_dl_do_lookup, _dl_do_lookup_versioned): New functions.
(_dl_lookup_symbol, _dl_lookup_symbol_skip,
_dl_lookup_versioned_symbol, _dl_lookup_versioned_symbol_skip): Use
it if we don't want do_lookup* inlined.

2001-05-18 Jakub Jelinek <jakub@redhat.com>

* include/link.h (struct r_scope_elem): Remove r_duplist and
r_nduplist fields.
* elf/dl-load.c (_dl_map_object_from_fd): Don't initialize them.
* elf/dl-lookup.c (_dl_lookup_symbol_skip): Look in r_list, not
r_duplist.
(_dl_lookup_versioned_symbol_skip): Likewise.
* elf/dl-deps.c (struct list): Remove dup field, rename unique to next.
(_dl_map_object_deps): Don't compute duplicate list.

* elf/dl-symbol.c: Removed.
* elf/Makefile (routines): Remove dl-symbol.

2001-05-22 Ulrich Drepper <drepper@redhat.com>

* po/el.po: Update from translation team.
* po/sv.po: Likewise.

2001-05-20 Bruno Haible <haible@clisp.cons.org>

* iconvdata/cp1255.c: Completely rewritten.
Expand Down
2 changes: 1 addition & 1 deletion elf/Makefile
Expand Up @@ -21,7 +21,7 @@
subdir := elf

headers = elf.h bits/elfclass.h link.h
routines = $(dl-routines) dl-open dl-close dl-symbol dl-support \
routines = $(dl-routines) dl-open dl-close dl-support \
dl-addr enbl-secure dl-profstub dl-origin dl-libc dl-sym

# The core dynamic linking functions are in libc for the static and
Expand Down
119 changes: 39 additions & 80 deletions elf/dl-deps.c
Expand Up @@ -72,20 +72,15 @@ openaux (void *a)



/* We use a very special kind of list to track the two kinds paths
/* We use a very special kind of list to track the path
through the list of loaded shared objects. We have to
- produce a flat list with unique members of all involved objects
- produce a flat list of all shared objects.
produce a flat list with unique members of all involved objects.
*/
struct list
{
int done; /* Nonzero if this map was processed. */
struct link_map *map; /* The data. */

struct list *unique; /* Elements for normal list. */
struct list *dup; /* Elements in complete list. */
struct list *next; /* Elements for normal list. */
};


Expand Down Expand Up @@ -139,8 +134,8 @@ _dl_map_object_deps (struct link_map *map,
int trace_mode)
{
struct list known[1 + npreloads + 1];
struct list *runp, *utail, *dtail;
unsigned int nlist, nduplist, i;
struct list *runp, *tail;
unsigned int nlist, i;
/* Object name. */
const char *name;
int errno_saved;
Expand All @@ -153,9 +148,7 @@ _dl_map_object_deps (struct link_map *map,
{
known[nlist].done = 0;
known[nlist].map = map;

known[nlist].unique = &known[nlist + 1];
known[nlist].dup = &known[nlist + 1];
known[nlist].next = &known[nlist + 1];

++nlist;
/* We use `l_reserved' as a mark bit to detect objects we have
Expand All @@ -175,17 +168,10 @@ _dl_map_object_deps (struct link_map *map,
preload (preloads[i]);

/* Terminate the lists. */
known[nlist - 1].unique = NULL;
known[nlist - 1].dup = NULL;
known[nlist - 1].next = NULL;

/* Pointer to last unique object. */
utail = &known[nlist - 1];
/* Pointer to last loaded object. */
dtail = &known[nlist - 1];

/* Until now we have the same number of libraries in the normal and
the list with duplicates. */
nduplist = nlist;
tail = &known[nlist - 1];

/* Process each element of the search list, loading each of its
auxiliary objects and immediate dependencies. Auxiliary objects
Expand Down Expand Up @@ -235,8 +221,6 @@ _dl_map_object_deps (struct link_map *map,
{
/* Map in the needed object. */
struct link_map *dep;
/* Allocate new entry. */
struct list *newp;
const char *objname;

/* Recognize DSTs. */
Expand All @@ -255,21 +239,19 @@ _dl_map_object_deps (struct link_map *map,
else
dep = args.aux;

/* Add it in any case to the duplicate list. */
newp = alloca (sizeof (struct list));
newp->map = dep;
newp->dup = NULL;
dtail->dup = newp;
dtail = newp;
++nduplist;

if (! dep->l_reserved)
{
/* Append DEP to the unique list. */
/* Allocate new entry. */
struct list *newp;

newp = alloca (sizeof (struct list));

/* Append DEP to the list. */
newp->map = dep;
newp->done = 0;
newp->unique = NULL;
utail->unique = newp;
utail = newp;
newp->next = NULL;
tail->next = newp;
tail = newp;
++nlist;
/* Set the mark bit that says it's already in the list. */
dep->l_reserved = 1;
Expand Down Expand Up @@ -343,7 +325,7 @@ _dl_map_object_deps (struct link_map *map,
but we have no back links. So we copy the contents of
the current entry over. Note that ORIG and NEWP now
have switched their meanings. */
orig->dup = memcpy (newp, orig, sizeof (*newp));
memcpy (newp, orig, sizeof (*newp));

/* Initialize new entry. */
orig->done = 0;
Expand Down Expand Up @@ -372,22 +354,22 @@ _dl_map_object_deps (struct link_map *map,
/* This object is already in the search list we
are building. Don't add a duplicate pointer.
Just added by _dl_map_object. */
for (late = newp; late->unique; late = late->unique)
if (late->unique->map == args.aux)
for (late = newp; late->next; late = late->next)
if (late->next->map == args.aux)
break;

if (late->unique)
if (late->next)
{
/* The object is somewhere behind the current
position in the search path. We have to
move it to this earlier position. */
orig->unique = newp;
orig->next = newp;

/* Now remove the later entry from the unique list
/* Now remove the later entry from the list
and adjust the tail pointer. */
if (utail == late->unique)
utail = late;
late->unique = late->unique->unique;
if (tail == late->next)
tail = late;
late->next = late->next->next;

/* We must move the object earlier in the chain. */
if (args.aux->l_prev)
Expand All @@ -406,25 +388,25 @@ _dl_map_object_deps (struct link_map *map,
/* The object must be somewhere earlier in the
list. That's good, we only have to insert
an entry for the duplicate list. */
orig->unique = NULL; /* Never used. */
orig->next = NULL; /* Never used. */

/* Now we have a problem. The element
pointing to ORIG in the unique list must
pointing to ORIG in the list must
point to NEWP now. This is the only place
where we need this backreference and this
situation is really not that frequent. So
we don't use a double-linked list but
instead search for the preceding element. */
late = known;
while (late->unique != orig)
late = late->unique;
late->unique = newp;
while (late->next != orig)
late = late->next;
late->next = newp;
}
}
else
{
/* This is easy. We just add the symbol right here. */
orig->unique = newp;
orig->next = newp;
++nlist;
/* Set the mark bit that says it's already in the list. */
args.aux->l_reserved = 1;
Expand All @@ -444,17 +426,12 @@ _dl_map_object_deps (struct link_map *map,
args.aux->l_next = newp->map;
}

/* Move the tail pointers if necessary. */
if (orig == utail)
utail = newp;
if (orig == dtail)
dtail = newp;
/* Move the tail pointer if necessary. */
if (orig == tail)
tail = newp;

/* Move on the insert point. */
orig = newp;

/* We always add an entry to the duplicate list. */
++nduplist;
}
}

Expand All @@ -473,7 +450,7 @@ _dl_map_object_deps (struct link_map *map,
/* If we have no auxiliary objects just go on to the next map. */
if (runp->done)
do
runp = runp->unique;
runp = runp->next;
while (runp != NULL && runp->done);
}

Expand All @@ -492,8 +469,7 @@ _dl_map_object_deps (struct link_map *map,
/* Store the search list we built in the object. It will be used for
searches in the scope of this object. */
map->l_initfini =
(struct link_map **) malloc ((2 * nlist + 1
+ (nlist == nduplist ? 0 : nduplist))
(struct link_map **) malloc ((2 * nlist + 1)
* sizeof (struct link_map *));
if (map->l_initfini == NULL)
_dl_signal_error (ENOMEM, map->l_name,
Expand All @@ -503,7 +479,7 @@ _dl_map_object_deps (struct link_map *map,
map->l_searchlist.r_list = &map->l_initfini[nlist + 1];
map->l_searchlist.r_nlist = nlist;

for (nlist = 0, runp = known; runp; runp = runp->unique)
for (nlist = 0, runp = known; runp; runp = runp->next)
{
if (trace_mode && runp->map->l_faked)
/* This can happen when we trace the loading. */
Expand All @@ -516,23 +492,6 @@ _dl_map_object_deps (struct link_map *map,
runp->map->l_reserved = 0;
}

map->l_searchlist.r_nduplist = nduplist;
if (nlist == nduplist)
map->l_searchlist.r_duplist = map->l_searchlist.r_list;
else
{
unsigned int cnt;

map->l_searchlist.r_duplist = map->l_searchlist.r_list + nlist;

for (cnt = 0, runp = known; runp; runp = runp->dup)
if (trace_mode && runp->map->l_faked)
/* This can happen when we trace the loading. */
--map->l_searchlist.r_nduplist;
else
map->l_searchlist.r_duplist[cnt++] = runp->map;
}

/* Now determine the order in which the initialization has to happen. */
memcpy (map->l_initfini, map->l_searchlist.r_list,
nlist * sizeof (struct link_map *));
Expand Down
2 changes: 0 additions & 2 deletions elf/dl-load.c
Expand Up @@ -1126,8 +1126,6 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,

l->l_symbolic_searchlist.r_list[0] = l;
l->l_symbolic_searchlist.r_nlist = 1;
l->l_symbolic_searchlist.r_duplist = l->l_symbolic_searchlist.r_list;
l->l_symbolic_searchlist.r_nduplist = 1;

/* Now move the existing entries one back. */
memmove (&l->l_scope[1], &l->l_scope[0],
Expand Down

0 comments on commit 80d9c5f

Please sign in to comment.