+2001-09-04 Ulrich Drepper <drepper@redhat.com>
+
+ Correct very misleading message for error in failed runtime relocation.
+ * elf/dl-error.c (_dl_signal_error): Take extra parameter to describe
+ place of the error.
+ (_dl_signal_cerror): Likewise.
+ * sysdeps/generic/ldsodefs.h: Adjust prototypes.
+ * elf/dl-close.c: Likewise.
+ * elf/dl-deps.c: Likewise.
+ * elf/dl-load.c: Likewise.
+ * elf/dl-lookup.c: Likewise.
+ * elf/dl-open.c: Likewise.
+ * elf/dl-reloc.c: Likewise.
+ * elf/dl-sym.c: Likewise.
+ * elf/dl-version.c: Likewise.
+ * sysdeps/generic/dl-sysdep.c: Likewise.
+
2001-09-04 Jakub Jelinek <jakub@redhat.com>
* iconv/strtab.c (strtabinit): Initialize null Strent.
return;
if (__builtin_expect (map->l_opencount, 1) == 0)
- _dl_signal_error (0, map->l_name, N_("shared object not open"));
+ _dl_signal_error (0, map->l_name, NULL, N_("shared object not open"));
/* Acquire the lock. */
__libc_lock_lock_recursive (_dl_load_lock);
\
/* DST must not appear in SUID/SGID programs. */ \
if (__libc_enable_secure) \
- _dl_signal_error (0, __str, \
+ _dl_signal_error (0, __str, NULL, \
N_("DST not allowed in SUID/SGID programs")); \
\
__newp = (char *) alloca (DL_DST_REQUIRED (l, __str, strlen (__str), \
/* The replacement for the DST is not known. We can't \
processed. */ \
if (fatal) \
- _dl_signal_error (0, __str, N_("\
+ _dl_signal_error (0, __str, NULL, N_("\
empty dynamics string token substitution")); \
else \
{ \
l->l_initfini = malloc (nneeded * sizeof needed[0]);
if (l->l_initfini == NULL)
- _dl_signal_error (ENOMEM, map->l_name,
+ _dl_signal_error (ENOMEM, map->l_name, NULL,
N_("cannot allocate dependency list"));
memcpy (l->l_initfini, needed, nneeded * sizeof needed[0]);
}
(struct link_map **) malloc ((2 * nlist + 1)
* sizeof (struct link_map *));
if (map->l_initfini == NULL)
- _dl_signal_error (ENOMEM, map->l_name,
+ _dl_signal_error (ENOMEM, map->l_name, NULL,
N_("cannot allocate symbol search list"));
if (runp != NULL)
{
while (*runp != NULL)
- if (*runp == l)
+ if (__builtin_expect (*runp++ == l, 0))
{
struct link_map *here = map->l_initfini[k];
break;
}
- else
- ++runp;
}
}
}
if (errno_reason)
_dl_signal_error (errno_reason == -1 ? 0 : errno_reason,
- objname, errstring);
+ objname, NULL, errstring);
}
void
internal_function
-_dl_signal_error (int errcode, const char *objname, const char *errstring)
+_dl_signal_error (int errcode, const char *objname, const char *occation,
+ const char *errstring)
{
struct catch *lcatch;
{
/* Lossage while resolving the program's own symbols is always fatal. */
char buffer[1024];
- _dl_fatal_printf ("\
-%s: error while loading shared libraries: %s%s%s%s%s\n",
+ _dl_fatal_printf ("%s: %s: %s%s%s%s%s\n",
_dl_argv[0] ?: "<program name unknown>",
+ occation ?: N_("error while loading shared libraries"),
objname, *objname ? ": " : "",
errstring, errcode ? ": " : "",
(errcode
void
internal_function
-_dl_signal_cerror (int errcode,
- const char *objname,
+_dl_signal_cerror (int errcode, const char *objname, const char *occation,
const char *errstring)
{
if (receiver)
(*receiver) (errcode, objname, errstring);
}
else
- _dl_signal_error (errcode, objname, errstring);
+ _dl_signal_error (errcode, objname, occation, errstring);
}
if (newname == NULL)
{
/* No more memory. */
- _dl_signal_error (ENOMEM, name, N_("cannot allocate name record"));
+ _dl_signal_error (ENOMEM, name, NULL, N_("cannot allocate name record"));
return;
}
/* The object should have a libname set from _dl_new_object. */
malloc (sizeof (*dirp) + ncapstr * sizeof (enum r_dir_status)
+ where_len + len + 1);
if (dirp == NULL)
- _dl_signal_error (ENOMEM, NULL,
+ _dl_signal_error (ENOMEM, NULL, NULL,
N_("cannot create cache for search path"));
dirp->dirname = ((char *) dirp + sizeof (*dirp)
result = (struct r_search_path_elem **)
malloc (sizeof (*result));
if (result == NULL)
- _dl_signal_error (ENOMEM, NULL,
+ _dl_signal_error (ENOMEM, NULL, NULL,
N_("cannot create cache for search path"));
result[0] = NULL;
string tokens. */
copy = expand_dynamic_string_token (l, rpath);
if (copy == NULL)
- _dl_signal_error (ENOMEM, NULL, N_("cannot create RUNPATH/RPATH copy"));
+ _dl_signal_error (ENOMEM, NULL, NULL,
+ N_("cannot create RUNPATH/RPATH copy"));
/* Count the number of necessary elements in the result array. */
nelems = 0;
result = (struct r_search_path_elem **) malloc ((nelems + 1 + 1)
* sizeof (*result));
if (result == NULL)
- _dl_signal_error (ENOMEM, NULL, N_("cannot create cache for search path"));
+ _dl_signal_error (ENOMEM, NULL, NULL,
+ N_("cannot create cache for search path"));
fillin_rpath (copy, result, ":", 0, what, where);
aelem = rtld_search_dirs.dirs = (struct r_search_path_elem **)
malloc ((nsystem_dirs_len + 1) * sizeof (struct r_search_path_elem *));
if (rtld_search_dirs.dirs == NULL)
- _dl_signal_error (ENOMEM, NULL, N_("cannot create search path array"));
+ _dl_signal_error (ENOMEM, NULL, NULL,
+ N_("cannot create search path array"));
round_size = ((2 * sizeof (struct r_search_path_elem) - 1
+ ncapstr * sizeof (enum r_dir_status))
malloc ((sizeof (system_dirs) / sizeof (system_dirs[0]))
* round_size * sizeof (struct r_search_path_elem));
if (rtld_search_dirs.dirs[0] == NULL)
- _dl_signal_error (ENOMEM, NULL, N_("cannot create cache for search path"));
+ _dl_signal_error (ENOMEM, NULL, NULL,
+ N_("cannot create cache for search path"));
rtld_search_dirs.malloced = 0;
pelem = _dl_all_dirs = rtld_search_dirs.dirs[0];
env_path_list.dirs = (struct r_search_path_elem **)
malloc ((nllp + 1) * sizeof (struct r_search_path_elem *));
if (env_path_list.dirs == NULL)
- _dl_signal_error (ENOMEM, NULL,
+ _dl_signal_error (ENOMEM, NULL, NULL,
N_("cannot create cache for search path"));
(void) fillin_rpath (llp_tmp, env_path_list.dirs, ":;",
free (l);
}
free (realname);
- _dl_signal_error (code, name, msg);
+ _dl_signal_error (code, name, NULL, msg);
}
if (_dl_zerofd == -1)
{
__close (fd);
- _dl_signal_error (errno, NULL, N_("cannot open zero fill device"));
+ _dl_signal_error (errno, NULL, NULL,
+ N_("cannot open zero fill device"));
}
}
#endif
free (l);
- _dl_signal_error (0, name, N_("shared object cannot be dlopen()ed"));
+ _dl_signal_error (0, name, NULL,
+ N_("shared object cannot be dlopen()ed"));
}
if (l->l_info[DT_HASH])
/* Enter the new object in the list of loaded objects. */
if ((name_copy = local_strdup (name)) == NULL
|| (l = _dl_new_object (name_copy, name, type, loader)) == NULL)
- _dl_signal_error (ENOMEM, name,
+ _dl_signal_error (ENOMEM, name, NULL,
N_("cannot create shared object descriptor"));
/* Signal that this is a faked entry. */
l->l_faked = 1;
return l;
}
else
- _dl_signal_error (errno, name, N_("cannot open shared object file"));
+ _dl_signal_error (errno, name, NULL,
+ N_("cannot open shared object file"));
}
return _dl_map_object_from_fd (name, fd, &fb, realname, loader, type, mode);
02111-1307 USA. */
#include <alloca.h>
+#include <libintl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
_dl_signal_cerror (0, (reference_name && reference_name[0]
? reference_name
: (_dl_argv[0] ?: "<main program>")),
+ N_("relocation error"),
make_string (undefined_msg, undef_name));
*ref = NULL;
return 0;
_dl_signal_cerror (0, (reference_name && reference_name[0]
? reference_name
: (_dl_argv[0] ?: "<main program>")),
+ N_("relocation error"),
make_string ("symbol ", undef_name, ", version ",
version->name,
" not defined in file ",
/* XXX We cannot translate the message. */
_dl_signal_cerror (0, (reference_name && reference_name[0]
? reference_name
- : (_dl_argv[0] ?: "<main program>")),
+ : (_dl_argv[0] ?: "<main program>")), NULL,
make_string (undefined_msg, undef_name,
", version ",
version->name ?: NULL));
/* XXX We cannot translate the messages. */
_dl_signal_cerror (0, (reference_name && reference_name[0]
? reference_name
- : (_dl_argv[0] ?: "<main program>")), buf);
+ : (_dl_argv[0] ?: "<main program>")),
+ NULL, buf);
}
*ref = NULL;
return 0;
{
_dl_global_scope_alloc = 0;
nomem:
- _dl_signal_error (ENOMEM, new->l_libname->name,
+ _dl_signal_error (ENOMEM, new->l_libname->name, NULL,
N_("cannot extend global scope"));
return 1;
}
/* DSTs must not appear in SUID/SGID programs. */
if (__libc_enable_secure)
/* This is an error. */
- _dl_signal_error (0, "dlopen",
+ _dl_signal_error (0, "dlopen", NULL,
N_("DST not allowed in SUID/SGID programs"));
/* We have to find out from which object the caller is calling. */
/* If the substitution failed don't try to load. */
if (*new_file == '\0')
- _dl_signal_error (0, "dlopen",
+ _dl_signal_error (0, "dlopen", NULL,
N_("empty dynamic string token substitution"));
/* Now we have a new file name. */
if ((mode & RTLD_BINDING_MASK) == 0)
/* One of the flags must be set. */
- _dl_signal_error (EINVAL, file, N_("invalid mode for dlopen()"));
+ _dl_signal_error (EINVAL, file, NULL, N_("invalid mode for dlopen()"));
/* Make sure we are alone. */
__libc_lock_lock_recursive (_dl_load_lock);
free ((char *) errstring);
/* Reraise the error. */
- _dl_signal_error (errcode, objname, local_errstring);
+ _dl_signal_error (errcode, objname, NULL, local_errstring);
}
#ifndef SHARED
& ~(_dl_pagesize - 1)));
if (__builtin_expect (__mprotect (mapstart, mapend - mapstart,
PROT_READ|PROT_WRITE), 0) < 0)
- _dl_signal_error (errno, l->l_name, N_("\
+ _dl_signal_error (errno, l->l_name, NULL, N_("\
cannot make segment writable for relocation"));
}
}
if (__builtin_expect (__mprotect (mapstart, mapend - mapstart,
prot), 0) < 0)
- _dl_signal_error (errno, l->l_name,
+ _dl_signal_error (errno, l->l_name, NULL,
N_("can't restore segment prot after reloc"));
#ifdef CLEAR_CACHE
static char msg[] = "unexpected PLT reloc type 0x??";
msg[sizeof msg - 3] = DIGIT(type >> 4);
msg[sizeof msg - 2] = DIGIT(type);
- _dl_signal_error (0, map->l_name, msg);
+ _dl_signal_error (0, map->l_name, NULL, msg);
}
else
{
static char msg[] = "unexpected reloc type 0x??";
msg[sizeof msg - 3] = DIGIT(type >> 4);
msg[sizeof msg - 2] = DIGIT(type);
- _dl_signal_error (0, map->l_name, msg);
+ _dl_signal_error (0, map->l_name, NULL, msg);
}
}
/* Look up a symbol in a shared object loaded by `dlopen'.
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
if (! _dl_loaded
|| caller < _dl_loaded->l_map_start
|| caller >= _dl_loaded->l_map_end)
- _dl_signal_error (0, NULL, N_("\
+ _dl_signal_error (0, NULL, NULL, N_("\
RTLD_NEXT used in code not dynamically loaded"));
}
if (! _dl_loaded
|| caller < _dl_loaded->l_map_start
|| caller >= _dl_loaded->l_map_end)
- _dl_signal_error (0, NULL, N_("\
+ _dl_signal_error (0, NULL, NULL, N_("\
RTLD_NEXT used in code not dynamically loaded"));
}
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],
+ _dl_signal_cerror (0, map->l_name[0] ? map->l_name : _dl_argv[0], NULL,
make_string ("\
no version information available (required by ",
name, ")"));
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 ",
_itoa_word (def->vd_version,
&buf[sizeof (buf) - 1],
{
if (verbose)
/* XXX We cannot translate the message. */
- _dl_signal_cerror (0, map->l_name[0] ? map->l_name : _dl_argv[0],
+ _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,
")"));
}
/* XXX We cannot translate the message. */
- _dl_signal_cerror (0, map->l_name[0] ? map->l_name : _dl_argv[0],
+ _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;
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 ",
_itoa_word (ent->vn_version,
&buf[sizeof (buf) - 1],
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;
}
#include <elf.h>
#include <errno.h>
#include <fcntl.h>
+#include <libintl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
if (result == NULL)
{
no_memory:
- _dl_signal_error (ENOMEM, NULL, "cannot create capability list");
+ _dl_signal_error (ENOMEM, NULL, NULL,
+ N_("cannot create capability list"));
}
result[0].str = (char *) result; /* Does not really matter. */
it is a general problem; ERRSTRING is a string describing the specific
problem. */
extern void _dl_signal_error (int errcode, const char *object,
- const char *errstring)
+ const char *occurred, const char *errstring)
internal_function
__attribute__ ((__noreturn__));
/* Like _dl_signal_error, but may return when called in the context of
_dl_receive_error. */
-extern void _dl_signal_cerror (int errcode,
- const char *object,
- const char *errstring)
+extern void _dl_signal_cerror (int errcode, const char *object,
+ const char *occation, const char *errstring)
internal_function;
/* Call OPERATE, receiving errors from `dl_signal_cerror'. Unlike