aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-09-05 03:42:43 +0000
committerUlrich Drepper <drepper@redhat.com>2001-09-05 03:42:43 +0000
commit407fe3bbb3708abc6796acc71c5fe34371c2847c (patch)
tree918b347c952d9d399789d21394b991bd42916977 /elf
parent71ce28fd1abbccc9814d199d770e673135a33ee1 (diff)
downloadglibc-407fe3bbb3708abc6796acc71c5fe34371c2847c.tar
glibc-407fe3bbb3708abc6796acc71c5fe34371c2847c.tar.gz
glibc-407fe3bbb3708abc6796acc71c5fe34371c2847c.tar.bz2
glibc-407fe3bbb3708abc6796acc71c5fe34371c2847c.zip
Update.
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.
Diffstat (limited to 'elf')
-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
9 files changed, 57 insertions, 45 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 66c88b2641..e83865f0a1 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 997cbfeb83..c4bc9874cc 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 bc328bc66c..be9a84361c 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 fe4e957ced..cf05ad0dc8 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 5fa6b73b50..2faa9fb99c 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 9d21a5045c..ec88c79a27 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 6e38648d88..931c9f455d 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 da3eb9e0a6..85d084f7f7 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 b362020e44..239507ee37 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;
}