summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-10-14 12:33:58 +0000
committerJakub Jelinek <jakub@redhat.com>2004-10-14 12:33:58 +0000
commit01682b1f05d8db303b38757b920248650c110ddb (patch)
treecc31dec885eb5e8c29154a02c1ee96f0e0cb29fc
parent82496aab644f7acdce3f3a693f3c78723b175124 (diff)
-rw-r--r--dlfcn/dlinfo.c12
-rw-r--r--include/errno.h2
-rw-r--r--sysdeps/mips/dl-machine.h9
-rw-r--r--sysdeps/powerpc/powerpc32/dl-machine.c48
4 files changed, 37 insertions, 34 deletions
diff --git a/dlfcn/dlinfo.c b/dlfcn/dlinfo.c
index 4e755ad044..d54a13259a 100644
--- a/dlfcn/dlinfo.c
+++ b/dlfcn/dlinfo.c
@@ -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_("\
diff --git a/include/errno.h b/include/errno.h
index d9f95aa982..9865903b86 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -37,7 +37,7 @@ extern __thread int errno attribute_tls_model_ie;
# ifndef __ASSEMBLER__
extern int *__errno_location (void) __THROW __attribute__ ((__const__))
-# ifdef RTLD_PRIVATE_ERRNO
+# if RTLD_PRIVATE_ERRNO
attribute_hidden
# endif
;
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index 944f3c10a5..49fdffb93d 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -231,10 +231,11 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
}
}
- {
- 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) gpreg, ElfW(Addr) stub_pc)
return l;
}
}
- l = l->l_next;
}
- }
_dl_signal_error (0, NULL, NULL, "cannot find runtime link map");
return NULL;
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.c b/sysdeps/powerpc/powerpc32/dl-machine.c
index 0dce04088b..606a1dd043 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.c
+++ b/sysdeps/powerpc/powerpc32/dl-machine.c
@@ -106,6 +106,7 @@ __elf_preferred_address(struct link_map *loader, size_t maplength,
{
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 *loader, size_t maplength,
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;