about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-error.c10
-rw-r--r--elf/dl-lookup.c5
-rw-r--r--elf/rtld.c3
3 files changed, 13 insertions, 5 deletions
diff --git a/elf/dl-error.c b/elf/dl-error.c
index 72af85985d..5e76d7d7d8 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -23,6 +23,9 @@
 #include <stdlib.h>
 #include <string.h>
 
+/* This is the internal function we use to generate the error string.  */
+extern char *_strerror_internal __P ((int, char *, size_t));
+
 /* This structure communicates state between _dl_catch_error and
    _dl_signal_error.  */
 struct catch
@@ -74,11 +77,14 @@ _dl_signal_error (int errcode,
     {
       /* Lossage while resolving the program's own symbols is always fatal.  */
       extern char **_dl_argv;	/* Set in rtld.c at startup.  */
+      char buffer[1024];
       _dl_sysdep_fatal (_dl_argv[0] ?: "<program name unknown>",
 			": error in loading shared libraries: ",
 			objname ?: "", objname ? ": " : "",
 			errstring, errcode ? ": " : "",
-			errcode ? strerror (errcode) : "", "\n", NULL);
+			(errcode
+			 ? _strerror_internal (errcode, buffer, sizeof buffer)
+			 : ""), "\n", NULL);
     }
 }
 
@@ -93,7 +99,7 @@ _dl_catch_error (char **errstring,
   /* We need not handle `receiver' since setting a `catch' is handled
      before it.  */
 
-  /* Some systems (.e.g, SPARC) handle constructors to local variables
+  /* Some systems (e.g., SPARC) handle constructors to local variables
      inefficient.  So we initialize `c' by hand.  */
   c.errstring = NULL;
   c.objname   = NULL;
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 2ec7e3a446..ef344794c5 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -279,6 +279,7 @@ _dl_lookup_versioned_symbol (const char *undef_name, const ElfW(Sym) **ref,
 			     const struct r_found_version *version,
 			     int reloc_type)
 {
+  extern char **_dl_argv;
   const unsigned long int hash = _dl_elf_hash (undef_name);
   struct sym_val current_value = { 0, NULL };
   struct link_map **scope;
@@ -295,7 +296,9 @@ _dl_lookup_versioned_symbol (const char *undef_name, const ElfW(Sym) **ref,
       if (res < 0)
 	/* Oh, oh.  The file named in the relocation entry does not
 	   contain the needed symbol.  */
-	_dl_signal_error (0, reference_name,
+	_dl_signal_error (0, (*reference_name
+			      ? reference_name
+			      : (_dl_argv[0] ?: "<main program>")),
 			  make_string ("symbol ", undef_name, ", version ",
 				       version->name,
 				       " not defined in file ",
diff --git a/elf/rtld.c b/elf/rtld.c
index 48d8575c89..b1538aa893 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -395,8 +395,7 @@ of this helper program; chances are you did not intend to run this program.\n",
     {
       /* Create a link_map for the executable itself.
 	 This will be what dlopen on "" returns.  */
-      main_map = _dl_new_object (_dl_argv[0] ?: (char *) "<main program>",
-				 "", lt_executable);
+      main_map = _dl_new_object ((char *) "", "", lt_executable);
       if (main_map == NULL)
 	_dl_sysdep_fatal ("cannot allocate memory for link map\n", NULL);
       main_map->l_phdr = phdr;