diff options
author | Florian Weimer <fweimer@redhat.com> | 2020-12-15 20:56:04 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2020-12-15 20:56:04 +0100 |
commit | 4d0985543f479a6f421d4d8a9e0d1dc71c9c2c53 (patch) | |
tree | 6cb5b4bcf2e7746a34fb402470690b4a72d1b052 /elf | |
parent | 7366cb03f8cc338f42bc86d99ad078eae1e3b7bf (diff) | |
download | glibc-4d0985543f479a6f421d4d8a9e0d1dc71c9c2c53.tar glibc-4d0985543f479a6f421d4d8a9e0d1dc71c9c2c53.tar.gz glibc-4d0985543f479a6f421d4d8a9e0d1dc71c9c2c53.tar.bz2 glibc-4d0985543f479a6f421d4d8a9e0d1dc71c9c2c53.zip |
elf: Record libc.so link map when it is the main program (bug 20972)
Otherwise, it will not participate in the dependency sorting.
Fixes commit 9ffa50b26b0cb5d3043adf6d3d0b1ea735acc147
("elf: Include libc.so.6 as main program in dependency sort
(bug 20972)").
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'elf')
-rw-r--r-- | elf/rtld.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/elf/rtld.c b/elf/rtld.c index 526360237f..38f11f5b73 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -49,6 +49,7 @@ #include <libc-early-init.h> #include <dl-main.h> #include <list.h> +#include <gnu/lib-names.h> #include <assert.h> @@ -1609,6 +1610,16 @@ dl_main (const ElfW(Phdr) *phdr, { /* 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); } |