From 44c3fe3909b8a180743fa772cc3461d493ecbcb8 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 27 Apr 2005 11:40:21 +0000 Subject: * 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. --- ChangeLog | 8 ++++++++ elf/dl-load.c | 30 +++++++++++++++++++++++++++++- elf/rtld.c | 6 ++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3179b70d25..4d540f02f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-04-27 Jakub Jelinek + + * 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 [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. */ -- cgit v1.2.3