From 0d23a5c1b1908700d25b7e3c6cece148e19dded4 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Fri, 31 Jan 2014 17:51:31 +0000 Subject: [BZ #16046] Static dlopen correction fallout fixes. Fixes to address issues from BZ #15022 resolution, as follows: * TLS updates to csu/libc-tls.c -- we now have a proper main map, so there's no longer a need to create a separate fake one to keep TLS structures, * random updates to elf/dl-close.c -- LM_ID_BASE is now a valid name space ID for static executables as well, so assert that we don't unload the main map. Similarly dl_nns isn't supposed to be 0 for static executables anymore, * actual BZ #16046 fix to elf/dl-iteratephdr.c -- the dl_iterate_phdr special function for static executables isn't needed anymore, provided that l_phdr and l_phnum members of the main map have been properly initialized (done in _dl_non_dynamic_init in elf/dl-support.c now), * ld.so.cache loader update to elf/dl-load.c -- GL(dl_ns)[LM_ID_BASE]._ns_loaded is now always initialized in static executables so can become the fallback loader map to check for DF_1_NODEFLIB, provided that the l_flags_1 member of the main map has been properly initialized (done in elf/dl-support.c now); this also ensures previous semantics elsewhere in elf/dl-load.c, * matching updates to elf/dl-support.c -- to complement the two fixes above. --- elf/dl-close.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'elf/dl-close.c') diff --git a/elf/dl-close.c b/elf/dl-close.c index c8ffcf8ebd..5bf1de7d28 100644 --- a/elf/dl-close.c +++ b/elf/dl-close.c @@ -643,9 +643,7 @@ _dl_close_worker (struct link_map *map) imap->l_prev->l_next = imap->l_next; else { -#ifdef SHARED assert (nsid != LM_ID_BASE); -#endif ns->_ns_loaded = imap->l_next; /* Update the pointer to the head of the list @@ -736,13 +734,7 @@ _dl_close_worker (struct link_map *map) if (__builtin_expect (ns->_ns_loaded == NULL, 0) && nsid == GL(dl_nns) - 1) do - { - --GL(dl_nns); -#ifndef SHARED - if (GL(dl_nns) == 0) - break; -#endif - } + --GL(dl_nns); while (GL(dl_ns)[GL(dl_nns) - 1]._ns_loaded == NULL); /* Notify the debugger those objects are finalized and gone. */ -- cgit v1.2.3