diff --git a/elf/rtld.c b/elf/rtld.c index fde5a6a..992f825 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -46,6 +46,7 @@ #include #include #include +#include #include @@ -1588,6 +1589,16 @@ ERROR: '%s': cannot process note segment.\n", _dl_argv[0]); { /* Extract the contents of the dynamic section for easy access. */ elf_get_dynamic_info (main_map, NULL); + + /* If the main map is libc.so, update the base namespace to + refer to this map. If libc.so is loaded later, this happens + in _dl_map_object_from_fd. */ + if (main_map->l_info[DT_SONAME] != NULL + && (strcmp (((const char *) D_PTR (main_map, l_info[DT_STRTAB]) + + main_map->l_info[DT_SONAME]->d_un.d_val), LIBC_SO) + == 0)) + GL(dl_ns)[LM_ID_BASE].libc_map = main_map; + /* Set up our cache of pointers into the hash table. */ _dl_setup_hash (main_map); }