summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2001-07-25 06:36:52 +0000
committerAndreas Jaeger <aj@suse.de>2001-07-25 06:36:52 +0000
commit78d16d09d8b8b4c29d566d45eaffd6bd7d2b7593 (patch)
treef3924a8d0ac601e21c122387ee8834f25ffc28e6
parentf369623d6d7af1f7cddfa7bcda413b88107db2e6 (diff)
downloadglibc-78d16d09d8b8b4c29d566d45eaffd6bd7d2b7593.tar.gz
glibc-78d16d09d8b8b4c29d566d45eaffd6bd7d2b7593.tar.xz
glibc-78d16d09d8b8b4c29d566d45eaffd6bd7d2b7593.zip
(__elf_preferred_address): Prefer gaps below main executable.
-rw-r--r--sysdeps/powerpc/dl-machine.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sysdeps/powerpc/dl-machine.c b/sysdeps/powerpc/dl-machine.c
index 0fdf2a4582..c9c4fe00d5 100644
--- a/sysdeps/powerpc/dl-machine.c
+++ b/sysdeps/powerpc/dl-machine.c
@@ -119,7 +119,11 @@ __elf_preferred_address(struct link_map *loader, size_t maplength,
       mapend = l->l_map_end | (_dl_pagesize - 1);
       assert (mapend > mapstart);
 
-      if ((mapend >= high || l == _dl_loaded) && high >= 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;