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-iteratephdr.c | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'elf/dl-iteratephdr.c') diff --git a/elf/dl-iteratephdr.c b/elf/dl-iteratephdr.c index 76e98aa..6572ec3 100644 --- a/elf/dl-iteratephdr.c +++ b/elf/dl-iteratephdr.c @@ -86,34 +86,4 @@ __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, } hidden_def (__dl_iterate_phdr) -#ifdef SHARED - weak_alias (__dl_iterate_phdr, dl_iterate_phdr); - -#else - -int -dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, - size_t size, void *data), void *data) -{ - if (_dl_phnum != 0) - { - /* This entry describes this statically-linked program itself. */ - struct dl_phdr_info info; - int ret; - info.dlpi_addr = 0; - info.dlpi_name = ""; - info.dlpi_phdr = _dl_phdr; - info.dlpi_phnum = _dl_phnum; - info.dlpi_adds = GL(dl_load_adds); - info.dlpi_subs = GL(dl_load_adds) - GL(dl_ns)[LM_ID_BASE]._ns_nloaded; - ret = (*callback) (&info, sizeof (struct dl_phdr_info), data); - if (ret) - return ret; - } - - return __dl_iterate_phdr (callback, data); -} - - -#endif -- cgit v1.1