mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
ld.so: Support moving versioned symbols between sonames [BZ #24741]
This change should be fully backwards-compatible because the old code aborted the load if a soname mismatch was encountered (instead of searching further for a matching symbol). This means that no different symbols are found. The soname check was explicitly disabled for the skip_map != NULL case. However, this only happens with dl(v)sym and RTLD_NEXT, and those lookups do not come with a verneed entry that could be used for the check. The error check was already explicitly disabled for the skip_map != NULL case, that is, when dl(v)sym was called with RTLD_NEXT. But _dl_vsym always sets filename in the struct r_found_version argument to NULL, so the check was not active anyway. This means that symbol lookup results for the skip_map != NULL case do not change, either.
This commit is contained in:
@@ -536,11 +536,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
|
||||
}
|
||||
|
||||
skip:
|
||||
/* If this current map is the one mentioned in the verneed entry
|
||||
and we have not found a weak entry, it is a bug. */
|
||||
if (symidx == STN_UNDEF && version != NULL && version->filename != NULL
|
||||
&& __glibc_unlikely (_dl_name_match_p (version->filename, map)))
|
||||
return -1;
|
||||
;
|
||||
}
|
||||
while (++i < n);
|
||||
|
||||
@@ -810,34 +806,10 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
|
||||
|
||||
/* Search the relevant loaded objects for a definition. */
|
||||
for (size_t start = i; *scope != NULL; start = 0, ++scope)
|
||||
{
|
||||
int res = do_lookup_x (undef_name, new_hash, &old_hash, *ref,
|
||||
¤t_value, *scope, start, version, flags,
|
||||
skip_map, type_class, undef_map);
|
||||
if (res > 0)
|
||||
break;
|
||||
|
||||
if (__glibc_unlikely (res < 0) && skip_map == NULL)
|
||||
{
|
||||
/* Oh, oh. The file named in the relocation entry does not
|
||||
contain the needed symbol. This code is never reached
|
||||
for unversioned lookups. */
|
||||
assert (version != NULL);
|
||||
const char *reference_name = undef_map ? undef_map->l_name : "";
|
||||
struct dl_exception exception;
|
||||
/* XXX We cannot translate the message. */
|
||||
_dl_exception_create_format
|
||||
(&exception, DSO_FILENAME (reference_name),
|
||||
"symbol %s version %s not defined in file %s"
|
||||
" with link time reference%s",
|
||||
undef_name, version->name, version->filename,
|
||||
res == -2 ? " (no version symbols)" : "");
|
||||
_dl_signal_cexception (0, &exception, N_("relocation error"));
|
||||
_dl_exception_free (&exception);
|
||||
*ref = NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (do_lookup_x (undef_name, new_hash, &old_hash, *ref,
|
||||
¤t_value, *scope, start, version, flags,
|
||||
skip_map, type_class, undef_map) != 0)
|
||||
break;
|
||||
|
||||
if (__glibc_unlikely (current_value.s == NULL))
|
||||
{
|
||||
|
Reference in New Issue
Block a user