aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-version.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-version.c')
-rw-r--r--elf/dl-version.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/elf/dl-version.c b/elf/dl-version.c
index cda0889..d9ec44e 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -23,6 +23,8 @@
#include <string.h>
#include <ldsodefs.h>
#include <_itoa.h>
+#include <gnu/lib-names.h>
+#include <libc-early-init.h>
#include <assert.h>
@@ -359,6 +361,22 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
}
}
+ /* Detect a libc.so loaded into this namespace. The
+ __libc_early_init lookup below means that we have to do this
+ after parsing the version data. */
+ if (GL(dl_ns)[map->l_ns].libc_map == NULL
+ && map->l_info[DT_SONAME] != NULL
+ && strcmp (((const char *) D_PTR (map, l_info[DT_STRTAB])
+ + map->l_info[DT_SONAME]->d_un.d_val), LIBC_SO) == 0)
+ {
+ /* Look up this symbol early to trigger a mismatch error before
+ relocation (which may call IFUNC resolvers, and those can
+ have an internal ABI dependency). */
+ GL(dl_ns)[map->l_ns].libc_map_early_init
+ = _dl_lookup_libc_early_init (map);
+ GL(dl_ns)[map->l_ns].libc_map = map;
+ }
+
/* When there is a DT_VERNEED entry with libc.so on DT_NEEDED, issue
an error if there is a DT_RELR entry without GLIBC_ABI_DT_RELR
dependency. */