From 604510f7170a912e7abd352d61b7686445216904 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 7 Oct 1998 13:40:55 +0000 Subject: Update. 1998-10-07 Ulrich Drepper * elf/dl-open.c (_dl_global_scope_alloc): Make global. (dl_open_worker): Use realloc, not malloc to resize array. * elf/rtld.c (_dl_initial_searchlist): New variable. (_dl_main): Copy content of _dl_main_searchlist to _dl_initial_searchlist. * elf/ldsodefs.h: Add declarations for _dl_initial_searchlist and _dl_global_scope_alloc. * elf/Versions [libc, GLIBC_2.1]: Add _dl_initial_searchlist. * elf/dl-close.c (_dl_close): When removing object with global scope remove allocated searchlist if no dynamically loaded object is on it anymore. * elf/dl-support.c (_dl_initial_searchlist): Renamed from fake_scope. (_dl_global_scope, _dl_main_searchlist): Use _dl_initial_searchlist. * malloc/mtrace.c (tr_where): Don't print space in location string, print it afterwards. Print better symbol name information. --- elf/dl-open.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'elf/dl-open.c') diff --git a/elf/dl-open.c b/elf/dl-open.c index e5509dffd4..83e6424c84 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -42,7 +42,10 @@ extern char **__libc_argv; extern char **__environ; -static size_t _dl_global_scope_alloc; +/* This is zero at program start to signal that the global scope map is + allocated by rtld. Later it keeps the size of the map. It might be + reset if in _dl_close if the last global object is removed. */ +size_t _dl_global_scope_alloc; /* During the program run we must not modify the global data of @@ -167,7 +170,9 @@ dl_open_worker (void *a) /* We have to extend the existing array of link maps in the main map. */ new_global = (struct link_map **) - malloc ((_dl_global_scope_alloc + 8) * sizeof (struct link_map *)); + realloc (_dl_main_searchlist->r_list, + ((_dl_global_scope_alloc + 8) + * sizeof (struct link_map *))); if (new_global == NULL) goto nomem; -- cgit v1.2.3