(_dl_lookup_symbol): If we use the cache we don't have to compute the hash value and initialize current_value. Move reference_name variable to where it is needed. (_dl_lookup_versioned_symbol): Likewise.
This commit is contained in:
parent
fb2c7eab2e
commit
c90b5d2838
|
@ -197,9 +197,8 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
|
||||||
const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[],
|
const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[],
|
||||||
int reloc_type, int explicit)
|
int reloc_type, int explicit)
|
||||||
{
|
{
|
||||||
const char *reference_name = undef_map ? undef_map->l_name : NULL;
|
unsigned long int hash;
|
||||||
const unsigned long int hash = _dl_elf_hash (undef_name);
|
struct sym_val current_value;
|
||||||
struct sym_val current_value = { NULL, NULL };
|
|
||||||
struct r_scope_elem **scope;
|
struct r_scope_elem **scope;
|
||||||
int protected;
|
int protected;
|
||||||
int noexec = elf_machine_lookup_noexec_p (reloc_type);
|
int noexec = elf_machine_lookup_noexec_p (reloc_type);
|
||||||
|
@ -218,6 +217,9 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
|
||||||
|
|
||||||
++_dl_num_relocations;
|
++_dl_num_relocations;
|
||||||
|
|
||||||
|
hash = _dl_elf_hash (undef_name);
|
||||||
|
current_value = ((struct sym_val) { NULL, NULL });
|
||||||
|
|
||||||
/* Search the relevant loaded objects for a definition. */
|
/* Search the relevant loaded objects for a definition. */
|
||||||
for (scope = symbol_scope; *scope; ++scope)
|
for (scope = symbol_scope; *scope; ++scope)
|
||||||
if (do_lookup (undef_name, hash, *ref, ¤t_value, *scope, 0, NULL,
|
if (do_lookup (undef_name, hash, *ref, ¤t_value, *scope, 0, NULL,
|
||||||
|
@ -251,6 +253,8 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
|
||||||
|
|
||||||
if (__builtin_expect (current_value.s == NULL, 0))
|
if (__builtin_expect (current_value.s == NULL, 0))
|
||||||
{
|
{
|
||||||
|
const char *reference_name = undef_map ? undef_map->l_name : NULL;
|
||||||
|
|
||||||
if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
|
if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
|
||||||
/* We could find no value for a strong reference. */
|
/* We could find no value for a strong reference. */
|
||||||
/* XXX We cannot translate the messages. */
|
/* XXX We cannot translate the messages. */
|
||||||
|
@ -267,12 +271,16 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
|
||||||
protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
|
protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
|
||||||
|
|
||||||
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
|
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
|
||||||
|
{
|
||||||
|
const char *reference_name = undef_map ? undef_map->l_name : NULL;
|
||||||
|
|
||||||
_dl_debug_printf ("binding file %s to %s: %s symbol `%s'\n",
|
_dl_debug_printf ("binding file %s to %s: %s symbol `%s'\n",
|
||||||
(reference_name && reference_name[0]
|
(reference_name && reference_name[0]
|
||||||
? reference_name : (_dl_argv[0] ?: "<main program>")),
|
? reference_name : (_dl_argv[0] ?: "<main program>")),
|
||||||
current_value.m->l_name[0]
|
current_value.m->l_name[0]
|
||||||
? current_value.m->l_name : _dl_argv[0],
|
? current_value.m->l_name : _dl_argv[0],
|
||||||
protected ? "protected" : "normal", undef_name);
|
protected ? "protected" : "normal", undef_name);
|
||||||
|
}
|
||||||
|
|
||||||
if (__builtin_expect (protected == 0, 1))
|
if (__builtin_expect (protected == 0, 1))
|
||||||
{
|
{
|
||||||
|
@ -399,9 +407,8 @@ _dl_lookup_versioned_symbol (const char *undef_name,
|
||||||
const struct r_found_version *version,
|
const struct r_found_version *version,
|
||||||
int reloc_type, int explicit)
|
int reloc_type, int explicit)
|
||||||
{
|
{
|
||||||
const char *reference_name = undef_map ? undef_map->l_name : NULL;
|
unsigned long int hash;
|
||||||
const unsigned long int hash = _dl_elf_hash (undef_name);
|
struct sym_val current_value;
|
||||||
struct sym_val current_value = { NULL, NULL };
|
|
||||||
struct r_scope_elem **scope;
|
struct r_scope_elem **scope;
|
||||||
int protected;
|
int protected;
|
||||||
int noexec = elf_machine_lookup_noexec_p (reloc_type);
|
int noexec = elf_machine_lookup_noexec_p (reloc_type);
|
||||||
|
@ -421,6 +428,9 @@ _dl_lookup_versioned_symbol (const char *undef_name,
|
||||||
|
|
||||||
++_dl_num_relocations;
|
++_dl_num_relocations;
|
||||||
|
|
||||||
|
hash = _dl_elf_hash (undef_name);
|
||||||
|
current_value = ((struct sym_val) { NULL, NULL });
|
||||||
|
|
||||||
/* Search the relevant loaded objects for a definition. */
|
/* Search the relevant loaded objects for a definition. */
|
||||||
for (scope = symbol_scope; *scope; ++scope)
|
for (scope = symbol_scope; *scope; ++scope)
|
||||||
{
|
{
|
||||||
|
@ -454,6 +464,8 @@ _dl_lookup_versioned_symbol (const char *undef_name,
|
||||||
{
|
{
|
||||||
/* Oh, oh. The file named in the relocation entry does not
|
/* Oh, oh. The file named in the relocation entry does not
|
||||||
contain the needed symbol. */
|
contain the needed symbol. */
|
||||||
|
const char *reference_name = undef_map ? undef_map->l_name : NULL;
|
||||||
|
|
||||||
/* XXX We cannot translate the message. */
|
/* XXX We cannot translate the message. */
|
||||||
_dl_signal_cerror (0, (reference_name && reference_name[0]
|
_dl_signal_cerror (0, (reference_name && reference_name[0]
|
||||||
? reference_name
|
? reference_name
|
||||||
|
@ -479,13 +491,19 @@ _dl_lookup_versioned_symbol (const char *undef_name,
|
||||||
if (__builtin_expect (current_value.s == NULL, 0))
|
if (__builtin_expect (current_value.s == NULL, 0))
|
||||||
{
|
{
|
||||||
if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
|
if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
|
||||||
|
{
|
||||||
/* We could find no value for a strong reference. */
|
/* We could find no value for a strong reference. */
|
||||||
|
const char *reference_name = undef_map ? undef_map->l_name : NULL;
|
||||||
|
|
||||||
/* XXX We cannot translate the message. */
|
/* XXX We cannot translate the message. */
|
||||||
_dl_signal_cerror (0, (reference_name && reference_name[0]
|
_dl_signal_cerror (0, (reference_name && reference_name[0]
|
||||||
? reference_name
|
? reference_name
|
||||||
: (_dl_argv[0] ?: "<main program>")),
|
: (_dl_argv[0] ?: "<main program>")),
|
||||||
make_string (undefined_msg, undef_name,
|
make_string (undefined_msg, undef_name,
|
||||||
", version ", version->name ?: NULL));
|
", version ",
|
||||||
|
version->name ?: NULL));
|
||||||
|
}
|
||||||
|
|
||||||
_dl_lookup_cache_versioned.ret = NULL;
|
_dl_lookup_cache_versioned.ret = NULL;
|
||||||
_dl_lookup_cache_versioned.value = 0;
|
_dl_lookup_cache_versioned.value = 0;
|
||||||
*ref = NULL;
|
*ref = NULL;
|
||||||
|
@ -495,6 +513,9 @@ _dl_lookup_versioned_symbol (const char *undef_name,
|
||||||
protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
|
protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
|
||||||
|
|
||||||
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
|
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
|
||||||
|
{
|
||||||
|
const char *reference_name = undef_map ? undef_map->l_name : NULL;
|
||||||
|
|
||||||
_dl_debug_printf ("binding file %s to %s: %s symbol `%s' [%s]\n",
|
_dl_debug_printf ("binding file %s to %s: %s symbol `%s' [%s]\n",
|
||||||
(reference_name && reference_name[0]
|
(reference_name && reference_name[0]
|
||||||
? reference_name : (_dl_argv[0] ?: "<main program>")),
|
? reference_name : (_dl_argv[0] ?: "<main program>")),
|
||||||
|
@ -502,6 +523,7 @@ _dl_lookup_versioned_symbol (const char *undef_name,
|
||||||
? current_value.m->l_name : _dl_argv[0],
|
? current_value.m->l_name : _dl_argv[0],
|
||||||
protected ? "protected" : "normal",
|
protected ? "protected" : "normal",
|
||||||
undef_name, version->name);
|
undef_name, version->name);
|
||||||
|
}
|
||||||
|
|
||||||
if (__builtin_expect (protected == 0, 1))
|
if (__builtin_expect (protected == 0, 1))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue