From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21636 invoked by alias); 14 Oct 2004 15:28:56 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 21619 invoked from network); 14 Oct 2004 15:28:55 -0000 Received: from unknown (HELO sunsite.ms.mff.cuni.cz) (195.113.15.26) by sourceware.org with SMTP; 14 Oct 2004 15:28:55 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8) with ESMTP id i9EFRe3j015525; Thu, 14 Oct 2004 17:27:40 +0200 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id i9EFRe2a015523; Thu, 14 Oct 2004 17:27:40 +0200 Date: Thu, 14 Oct 2004 15:28:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] Fix ppc32 (and probably mips) glibc build Message-ID: <20041014152740.GA30497@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2004-10/txt/msg00018.txt.bz2 Hi! Grep found 3 more occurences of GL(dl_loaded), one of them killed ppc32 build. 2004-10-14 Jakub Jelinek * dlfcn/dlinfo.c (dlinfo_doit): Replace iteration over GL(dl_loaded) chain with iteration over all namespaces' _ns_loaded chains. * sysdeps/powerpc/powerpc32/dl-machine.c (__elf_preferred_address): Likewise. * sysdeps/mips/dl-machine.h (elf_machine_runtime_link_map): Likewise. --- libc/dlfcn/dlinfo.c.jj 2004-10-14 07:55:31.000000000 +0200 +++ libc/dlfcn/dlinfo.c 2004-10-14 13:48:14.802418655 +0200 @@ -39,13 +39,15 @@ dlinfo_doit (void *argsblock) #if 0 if (args->handle == RTLD_SELF) { + Lmid_t nsid; /* Find the highest-addressed object that CALLER is not below. */ - for (l = GL(dl_loaded); l != NULL; l = l->l_next) - if (caller >= l->l_map_start && caller < l->l_map_end) - /* There must be exactly one DSO for the range of the virtual - memory. Otherwise something is really broken. */ - break; + for (nsid = 0; nsid < DL_NNS; ++nsid) + for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next) + if (caller >= l->l_map_start && caller < l->l_map_end) + /* There must be exactly one DSO for the range of the virtual + memory. Otherwise something is really broken. */ + break; if (l == NULL) GLRO(dl_signal_error) (0, NULL, NULL, N_("\ --- libc/sysdeps/powerpc/powerpc32/dl-machine.c.jj 2004-03-05 11:23:44.000000000 +0100 +++ libc/sysdeps/powerpc/powerpc32/dl-machine.c 2004-10-14 13:51:26.518237404 +0200 @@ -106,6 +106,7 @@ __elf_preferred_address(struct link_map { ElfW(Addr) low, high; struct link_map *l; + Lmid_t nsid; /* If the object has a preference, load it there! */ if (mapstartpref != 0) @@ -117,29 +118,30 @@ __elf_preferred_address(struct link_map be superceded by the program's load address). */ low = 0x0003FFFF; high = 0x70000000; - for (l = GL(dl_loaded); l; l = l->l_next) - { - ElfW(Addr) mapstart, mapend; - mapstart = l->l_map_start & ~(GLRO(dl_pagesize) - 1); - mapend = l->l_map_end | (GLRO(dl_pagesize) - 1); - assert (mapend > mapstart); - - /* Prefer gaps below the main executable, note that l == - _dl_loaded does not work for static binaries loading - e.g. libnss_*.so. */ - if ((mapend >= high || l->l_type == lt_executable) - && high >= mapstart) - high = mapstart; - else if (mapend >= low && low >= mapstart) - low = mapend; - else if (high >= mapend && mapstart >= low) - { - if (high - mapend >= mapstart - low) - low = mapend; - else - high = mapstart; - } - } + for (nsid = 0; nsid < DL_NNS; ++nsid) + for (l = GL(dl_ns)[nsid]._ns_loaded; l; l = l->l_next) + { + ElfW(Addr) mapstart, mapend; + mapstart = l->l_map_start & ~(GLRO(dl_pagesize) - 1); + mapend = l->l_map_end | (GLRO(dl_pagesize) - 1); + assert (mapend > mapstart); + + /* Prefer gaps below the main executable, note that l == + _dl_loaded does not work for static binaries loading + e.g. libnss_*.so. */ + if ((mapend >= high || l->l_type == lt_executable) + && high >= mapstart) + high = mapstart; + else if (mapend >= low && low >= mapstart) + low = mapend; + else if (high >= mapend && mapstart >= low) + { + if (high - mapend >= mapstart - low) + low = mapend; + else + high = mapstart; + } + } high -= 0x10000; /* Allow some room between objects. */ maplength = (maplength | (GLRO(dl_pagesize) - 1)) + 1; --- libc/sysdeps/mips/dl-machine.h.jj 2004-08-25 07:57:35.000000000 +0200 +++ libc/sysdeps/mips/dl-machine.h 2004-10-14 14:00:13.371350396 +0200 @@ -231,10 +231,11 @@ elf_machine_runtime_link_map (ElfW(Addr) } } - { - struct link_map *l = GL(dl_loaded); + struct link_map *l; + Lmid_t nsid; - while (l) + for (nsid = 0; nsid < DL_NNS; ++nsid) + for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next) { ElfW(Addr) base, limit; const ElfW(Phdr) *p = l->l_phdr; @@ -250,9 +251,7 @@ elf_machine_runtime_link_map (ElfW(Addr) return l; } } - l = l->l_next; } - } _dl_signal_error (0, NULL, NULL, "cannot find runtime link map"); return NULL; Jakub