about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-04-27 11:40:21 +0000
committerJakub Jelinek <jakub@redhat.com>2005-04-27 11:40:21 +0000
commit44c3fe3909b8a180743fa772cc3461d493ecbcb8 (patch)
tree4f458ccf64e6a0f932c68ccb0760434df76e39fa
parent35278cc7d7fe81e01bb092e76b775c169e7e85f6 (diff)
downloadglibc-44c3fe3909b8a180743fa772cc3461d493ecbcb8.tar.gz
glibc-44c3fe3909b8a180743fa772cc3461d493ecbcb8.tar.xz
glibc-44c3fe3909b8a180743fa772cc3461d493ecbcb8.zip
* elf/rtld.c (dl_main): Call _dl_init_linuxthreads_paths
	if GLRO(dl_osversion) <= 0x20413.
	* elf/dl-load.c (_dl_init_paths): Allocate one extra pointer in
	rtld_search_dirs.dirs.
	(_dl_init_linuxthreads_paths): New function.
-rw-r--r--ChangeLog8
-rw-r--r--elf/dl-load.c30
-rw-r--r--elf/rtld.c6
3 files changed, 43 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3179b70d25..4d540f02f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-04-27  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf/rtld.c (dl_main): Call _dl_init_linuxthreads_paths
+	if GLRO(dl_osversion) <= 0x20413.
+	* elf/dl-load.c (_dl_init_paths): Allocate one extra pointer in
+	rtld_search_dirs.dirs.
+	(_dl_init_linuxthreads_paths): New function.
+
 2005-04-27  Roland McGrath  <roland@redhat.com>
 
 	[BZ #877]
diff --git a/elf/dl-load.c b/elf/dl-load.c
index d8b3a56d0d..791c0dcba5 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -644,7 +644,7 @@ _dl_init_paths (const char *llp)
 
   /* First set up the rest of the default search directory entries.  */
   aelem = rtld_search_dirs.dirs = (struct r_search_path_elem **)
-    malloc ((nsystem_dirs_len + 1) * sizeof (struct r_search_path_elem *));
+    malloc ((nsystem_dirs_len + 2) * sizeof (struct r_search_path_elem *));
   if (rtld_search_dirs.dirs == NULL)
     {
       errstring = N_("cannot create search path array");
@@ -780,6 +780,34 @@ _dl_init_paths (const char *llp)
 }
 
 
+void
+internal_function
+_dl_init_linuxthreads_paths (void)
+{
+  size_t cnt;
+  struct r_search_path_elem *elem, **aelem;
+
+  elem = malloc (sizeof (struct r_search_path_elem)
+		 + ncapstr * sizeof (enum r_dir_status));
+  if (elem == NULL)
+    return;
+
+  for (aelem = rtld_search_dirs.dirs; *aelem; aelem++);
+  aelem[0] = elem;
+  aelem[1] = NULL;
+  elem->what = "linuxthreads search path";
+  elem->where = NULL;
+  elem->dirname = "/" DL_DST_LIB "/obsolete/linuxthreads/";
+  elem->dirnamelen = sizeof ("/" DL_DST_LIB "/obsolete/linuxthreads/") - 1;
+  if (elem->dirnamelen > max_dirnamelen)
+    max_dirnamelen = elem->dirnamelen;
+  for (cnt = 0; cnt < ncapstr; ++cnt)
+    elem->status[cnt] = unknown;
+  elem->next = NULL;
+  aelem[-1]->next = elem;
+}
+
+
 static void
 __attribute__ ((noreturn, noinline))
 lose (int code, int fd, const char *name, char *realname, struct link_map *l,
diff --git a/elf/rtld.c b/elf/rtld.c
index 5d64d5a99e..f3e55b6d9a 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1382,6 +1382,12 @@ ld.so does not support TLS, but program uses it!\n");
     }
 #endif
 
+  if (GLRO(dl_osversion) <= 0x20413)
+    {
+      extern void internal_function _dl_init_linuxthreads_paths (void);
+      _dl_init_linuxthreads_paths ();
+    }
+
   /* If LD_USE_LOAD_BIAS env variable has not been seen, default
      to not using bias for non-prelinked PIEs and libraries
      and using it for executables or prelinked PIEs or libraries.  */