|
|
e354a5 |
commit 4d0985543f479a6f421d4d8a9e0d1dc71c9c2c53
|
|
|
e354a5 |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
e354a5 |
Date: Tue Dec 15 20:56:04 2020 +0100
|
|
|
e354a5 |
|
|
|
e354a5 |
elf: Record libc.so link map when it is the main program (bug 20972)
|
|
|
e354a5 |
|
|
|
e354a5 |
Otherwise, it will not participate in the dependency sorting.
|
|
|
e354a5 |
|
|
|
e354a5 |
Fixes commit 9ffa50b26b0cb5d3043adf6d3d0b1ea735acc147
|
|
|
e354a5 |
("elf: Include libc.so.6 as main program in dependency sort
|
|
|
e354a5 |
(bug 20972)").
|
|
|
e354a5 |
|
|
|
e354a5 |
Conflicts:
|
|
|
e354a5 |
elf/rtld.c
|
|
|
e354a5 |
(Missing backported header include.)
|
|
|
e354a5 |
|
|
|
e354a5 |
diff --git a/elf/rtld.c b/elf/rtld.c
|
|
|
e354a5 |
index fde5a6a4a485207e..992f825ba00762a7 100644
|
|
|
e354a5 |
--- a/elf/rtld.c
|
|
|
e354a5 |
+++ b/elf/rtld.c
|
|
|
e354a5 |
@@ -46,6 +46,7 @@
|
|
|
e354a5 |
#include <array_length.h>
|
|
|
e354a5 |
#include <libc-early-init.h>
|
|
|
e354a5 |
#include <dl-main.h>
|
|
|
e354a5 |
+#include <gnu/lib-names.h>
|
|
|
e354a5 |
|
|
|
e354a5 |
#include <assert.h>
|
|
|
e354a5 |
|
|
|
e354a5 |
@@ -1588,6 +1589,16 @@ ERROR: '%s': cannot process note segment.\n", _dl_argv[0]);
|
|
|
e354a5 |
{
|
|
|
e354a5 |
/* Extract the contents of the dynamic section for easy access. */
|
|
|
e354a5 |
elf_get_dynamic_info (main_map, NULL);
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+ /* If the main map is libc.so, update the base namespace to
|
|
|
e354a5 |
+ refer to this map. If libc.so is loaded later, this happens
|
|
|
e354a5 |
+ in _dl_map_object_from_fd. */
|
|
|
e354a5 |
+ if (main_map->l_info[DT_SONAME] != NULL
|
|
|
e354a5 |
+ && (strcmp (((const char *) D_PTR (main_map, l_info[DT_STRTAB])
|
|
|
e354a5 |
+ + main_map->l_info[DT_SONAME]->d_un.d_val), LIBC_SO)
|
|
|
e354a5 |
+ == 0))
|
|
|
e354a5 |
+ GL(dl_ns)[LM_ID_BASE].libc_map = main_map;
|
|
|
e354a5 |
+
|
|
|
e354a5 |
/* Set up our cache of pointers into the hash table. */
|
|
|
e354a5 |
_dl_setup_hash (main_map);
|
|
|
e354a5 |
}
|