aboutsummaryrefslogtreecommitdiff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2022-08-25 18:46:41 +0200
committerFlorian Weimer <fweimer@redhat.com>2022-08-25 18:46:43 +0200
commit89baed0b93639180fd7d0ba922873b003649c7af (patch)
tree3d560f9563c042eb46fdd0a088d24e470b5e907d /elf/rtld.c
parent025a8cce63a1d9b3ea9e84d0e844f14ec872e184 (diff)
downloadglibc-89baed0b93639180fd7d0ba922873b003649c7af.zip
glibc-89baed0b93639180fd7d0ba922873b003649c7af.tar.gz
glibc-89baed0b93639180fd7d0ba922873b003649c7af.tar.bz2
Revert "Detect ld.so and libc.so version inconsistency during startup"
This reverts commit 6f85dbf102ad7982409ba0fe96886caeb6389fef. Once this change hits the release branches, it will require relinking of all statically linked applications before static dlopen works again, for the majority of updates on release branches: The NEWS file is regularly updated with bug references, so the __libc_early_init suffix changes, and static dlopen cannot find the function anymore. While this ABI check is still technically correct (we do require rebuilding & relinking after glibc updates to keep static dlopen working), it is too drastic for stable release branches. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 910075c..cbbaf4a 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1707,6 +1707,15 @@ dl_main (const ElfW(Phdr) *phdr,
/* Extract the contents of the dynamic section for easy access. */
elf_get_dynamic_info (main_map, false, false);
+ /* 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);
}
@@ -2377,8 +2386,7 @@ dl_main (const ElfW(Phdr) *phdr,
/* Relocation is complete. Perform early libc initialization. This
is the initial libc, even if audit modules have been loaded with
other libcs. */
- if (GL(dl_ns)[LM_ID_BASE].libc_map != NULL)
- GL(dl_ns)[LM_ID_BASE].libc_map_early_init (true);
+ _dl_call_libc_early_init (GL(dl_ns)[LM_ID_BASE].libc_map, true);
/* Do any necessary cleanups for the startup OS interface code.
We do these now so that no calls are made after rtld re-relocation