aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--elf/dl-close.c2
-rw-r--r--elf/dl-deps.c14
-rw-r--r--elf/dl-error.c12
-rw-r--r--elf/dl-load.c33
-rw-r--r--elf/dl-lookup.c8
-rw-r--r--elf/dl-open.c10
-rw-r--r--elf/dl-reloc.c8
-rw-r--r--elf/dl-sym.c6
-rw-r--r--elf/dl-version.c9
-rw-r--r--sysdeps/generic/dl-sysdep.c4
-rw-r--r--sysdeps/generic/ldsodefs.h7
12 files changed, 80 insertions, 50 deletions
diff --git a/ChangeLog b/ChangeLog
index 0f6f286..1e82860 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+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.
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 66c88b2..e83865f 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -53,7 +53,7 @@ _dl_close (void *_map)
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);
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index 997cbfe..c4bc987 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -97,7 +97,7 @@ struct list
\
/* 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), \
@@ -110,7 +110,7 @@ struct list
/* 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 \
{ \
@@ -450,7 +450,7 @@ _dl_map_object_deps (struct link_map *map,
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]);
}
@@ -480,7 +480,7 @@ out:
(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"));
@@ -527,7 +527,7 @@ out:
if (runp != NULL)
{
while (*runp != NULL)
- if (*runp == l)
+ if (__builtin_expect (*runp++ == l, 0))
{
struct link_map *here = map->l_initfini[k];
@@ -539,8 +539,6 @@ out:
break;
}
- else
- ++runp;
}
}
}
@@ -549,5 +547,5 @@ out:
if (errno_reason)
_dl_signal_error (errno_reason == -1 ? 0 : errno_reason,
- objname, errstring);
+ objname, NULL, errstring);
}
diff --git a/elf/dl-error.c b/elf/dl-error.c
index bc328bc..be9a843 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -63,7 +63,8 @@ static receiver_fct receiver;
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;
@@ -99,9 +100,9 @@ _dl_signal_error (int errcode, const char *objname, const char *errstring)
{
/* 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
@@ -113,8 +114,7 @@ _dl_signal_error (int errcode, const char *objname, const char *errstring)
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)
@@ -125,7 +125,7 @@ _dl_signal_cerror (int errcode,
(*receiver) (errcode, objname, errstring);
}
else
- _dl_signal_error (errcode, objname, errstring);
+ _dl_signal_error (errcode, objname, occation, errstring);
}
diff --git a/elf/dl-load.c b/elf/dl-load.c
index fe4e957..cf05ad0 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -345,7 +345,7 @@ add_name_to_object (struct link_map *l, const char *name)
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. */
@@ -452,7 +452,7 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
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)
@@ -521,7 +521,7 @@ decompose_rpath (struct r_search_path_struct *sps,
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;
@@ -537,7 +537,8 @@ decompose_rpath (struct r_search_path_struct *sps,
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;
@@ -550,7 +551,8 @@ decompose_rpath (struct r_search_path_struct *sps,
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);
@@ -587,7 +589,8 @@ _dl_init_paths (const char *llp)
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))
@@ -597,7 +600,8 @@ _dl_init_paths (const char *llp)
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];
@@ -689,7 +693,7 @@ _dl_init_paths (const char *llp)
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, ":;",
@@ -741,7 +745,7 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l,
free (l);
}
free (realname);
- _dl_signal_error (code, name, msg);
+ _dl_signal_error (code, name, NULL, msg);
}
@@ -819,7 +823,8 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
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
@@ -1101,7 +1106,8 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
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])
@@ -1720,7 +1726,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
/* 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;
@@ -1734,7 +1740,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
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);
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 5fa6b73..2faa9fb 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <alloca.h>
+#include <libintl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -236,6 +237,7 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
_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;
@@ -419,6 +421,7 @@ _dl_lookup_versioned_symbol (const char *undef_name,
_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 ",
@@ -441,7 +444,7 @@ _dl_lookup_versioned_symbol (const char *undef_name,
/* 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));
@@ -537,7 +540,8 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
/* 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;
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 9d21a50..ec88c79 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -108,7 +108,7 @@ add_to_global (struct link_map *new)
{
_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;
}
@@ -175,7 +175,7 @@ dl_open_worker (void *a)
/* 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. */
@@ -206,7 +206,7 @@ dl_open_worker (void *a)
/* 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. */
@@ -337,7 +337,7 @@ _dl_open (const char *file, int mode, const void *caller)
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);
@@ -396,7 +396,7 @@ _dl_open (const char *file, int mode, const void *caller)
free ((char *) errstring);
/* Reraise the error. */
- _dl_signal_error (errcode, objname, local_errstring);
+ _dl_signal_error (errcode, objname, NULL, local_errstring);
}
#ifndef SHARED
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index 6e38648..931c9f4 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -63,7 +63,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
& ~(_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"));
}
}
@@ -177,7 +177,7 @@ 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
@@ -201,7 +201,7 @@ _dl_reloc_bad_type (struct link_map *map, uint_fast8_t type, int plt)
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
{
@@ -209,6 +209,6 @@ _dl_reloc_bad_type (struct link_map *map, uint_fast8_t type, int plt)
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);
}
}
diff --git a/elf/dl-sym.c b/elf/dl-sym.c
index da3eb9e..85d084f 100644
--- a/elf/dl-sym.c
+++ b/elf/dl-sym.c
@@ -1,5 +1,5 @@
/* 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
@@ -69,7 +69,7 @@ _dl_sym (void *handle, const char *name, void *who)
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"));
}
@@ -131,7 +131,7 @@ _dl_vsym (void *handle, const char *name, const char *version, void *who)
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"));
}
diff --git a/elf/dl-version.c b/elf/dl-version.c
index b362020..239507e 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -96,7 +96,7 @@ checking for version `%s' in file %s required by file %s\n",
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, ")"));
@@ -117,6 +117,7 @@ no version information available (required by ",
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],
@@ -150,7 +151,7 @@ no version information available (required by ",
{
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,
")"));
@@ -158,7 +159,7 @@ no version information available (required by ",
}
/* 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;
@@ -200,6 +201,7 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
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],
@@ -289,6 +291,7 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
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;
}
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index ad25dad..c89ab3c 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -21,6 +21,7 @@
#include <elf.h>
#include <errno.h>
#include <fcntl.h>
+#include <libintl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -309,7 +310,8 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
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. */
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 5947381..a06ec78 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -292,15 +292,14 @@ extern void _dl_dprintf (int fd, const char *fmt, ...)
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