2001-11-07  Ulrich Drepper  <drepper@redhat.com>

	* elf/dl-version.c (match_symbol): Optimize error handling for size.
	(_dl_check_map_versions): Likewise.
This commit is contained in:
Ulrich Drepper 2001-11-07 23:21:00 +00:00
parent fb0356b9d6
commit 6ed623f848
3 changed files with 103 additions and 94 deletions

View File

@ -1,3 +1,8 @@
2001-11-07 Ulrich Drepper <drepper@redhat.com>
* elf/dl-version.c (match_symbol): Optimize error handling for size.
(_dl_check_map_versions): Likewise.
2001-11-06 Ulrich Drepper <drepper@redhat.com>
* elf/dl-load.c (_dl_map_object_from_fd): Don't call

View File

@ -81,6 +81,9 @@ match_symbol (const char *name, ElfW(Word) hash, const char *string,
const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
ElfW(Addr) def_offset;
ElfW(Verdef) *def;
/* Initialize to make the compiler happy. */
const char *errstring = NULL;
int result = 0;
/* Display information about what we are doing while debugging. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_VERSIONS, 0))
@ -95,11 +98,12 @@ checking for version `%s' in file %s required by file %s\n",
object was linked against another version of this file. We
only print a message if verbose output is requested. */
if (verbose)
{
/* XXX We cannot translate the messages. */
_dl_signal_cerror (0, map->l_name[0] ? map->l_name : _dl_argv[0], NULL,
make_string ("\
no version information available (required by ",
name, ")"));
errstring = make_string ("\
no version information available (required by ", name, ")");
goto call_cerror;
}
return 0;
}
@ -116,14 +120,12 @@ no version information available (required by ",
char buf[20];
buf[sizeof (buf) - 1] = '\0';
/* XXX We cannot translate the message. */
_dl_signal_error (0, map->l_name[0] ? map->l_name : _dl_argv[0],
NULL,
make_string ("unsupported version ",
errstring = make_string ("unsupported version ",
_itoa_word (def->vd_version,
&buf[sizeof (buf) - 1],
10, 0),
" of Verdef record"));
return 1;
&buf[sizeof (buf) - 1], 10, 0),
" of Verdef record");
result = 1;
goto call_cerror;
}
/* Compare the hash values. */
@ -150,19 +152,23 @@ no version information available (required by ",
if (__builtin_expect (weak, 1))
{
if (verbose)
{
/* XXX We cannot translate the message. */
_dl_signal_cerror (0, map->l_name[0] ? map->l_name : _dl_argv[0], NULL,
make_string ("weak version `", string,
"' not found (required by ", name,
")"));
errstring = make_string ("weak version `", string,
"' not found (required by ", name, ")");
goto call_cerror;
}
return 0;
}
/* XXX We cannot translate the message. */
errstring = make_string ("version `", string, "' not found (required by ",
name, ")");
result = 1;
call_cerror:
_dl_signal_cerror (0, map->l_name[0] ? map->l_name : _dl_argv[0], NULL,
make_string ("version `", string,
"' not found (required by ", name, ")"));
return 1;
errstring);
return result;
}
@ -179,6 +185,9 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
/* We need to find out which is the highest version index used
in a dependecy. */
unsigned int ndx_high = 0;
/* Initialize to make the compiler happy. */
const char *errstring = NULL;
int errval = 0;
/* If we don't have a string table, we must be ok. */
if (map->l_info[DT_STRTAB] == NULL)
@ -200,14 +209,13 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
char buf[20];
buf[sizeof (buf) - 1] = '\0';
/* XXX We cannot translate the message. */
_dl_signal_error (0, (*map->l_name ? map->l_name : _dl_argv[0]),
NULL,
make_string ("unsupported version ",
errstring = make_string ("unsupported version ",
_itoa_word (ent->vn_version,
&buf[sizeof (buf) - 1],
10, 0),
" of Verneed record\n"));
return 1;
&buf[sizeof (buf) - 1], 10, 0),
" of Verneed record\n");
call_error:
_dl_signal_error (errval, (*map->l_name ? map->l_name : _dl_argv[0]),
NULL, errstring);
}
while (1)
@ -290,19 +298,16 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
calloc (ndx_high + 1, sizeof (*map->l_versions));
if (__builtin_expect (map->l_versions == NULL, 0))
{
_dl_signal_error (ENOMEM, (*map->l_name ? map->l_name : _dl_argv[0]),
NULL,
N_("cannot allocate version reference table"));
result = 1;
errstring = N_("cannot allocate version reference table");
errval = ENOMEM;
goto call_error;
}
else
{
/* Store the number of available symbols. */
map->l_nversions = ndx_high + 1;
/* Compute the pointer to the version symbols. */
map->l_versyms =
(void *) D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]);
map->l_versyms = (void *) D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]);
if (dyn != NULL)
{
@ -365,7 +370,6 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
}
}
}
}
return result;
}