about summary refs log tree commit diff
path: root/elf/dl-lookup.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-lookup.c')
-rw-r--r--elf/dl-lookup.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index f2cd981883..b994ef711b 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -229,15 +229,20 @@ _dl_lookup_symbol (const char *undef_name, const ElfW(Sym) **ref,
     {
       if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
 	/* We could find no value for a strong reference.  */
-	_dl_signal_error (0, reference_name,
+	_dl_signal_error (0, (reference_name  && reference_name[0]
+			      ? reference_name
+			      : (_dl_argv[0] ?: "<main program>")),
 			  make_string (undefined_msg, undef_name));
       *ref = NULL;
       return 0;
     }
 
   if (_dl_debug_bindings)
-    _dl_debug_message (1, "binding file ", reference_name, " to ",
-		       current_value.m->l_name[0]
+    _dl_debug_message (1, "binding file ",
+		       (reference_name && reference_name[0]
+			? reference_name
+			: (_dl_argv[0] ?: "<main program>")),
+		       " to ", current_value.m->l_name[0]
 		       ? current_value.m->l_name : _dl_argv[0],
 		       ": symbol `", undef_name, "'\n", NULL);
 
@@ -281,10 +286,13 @@ _dl_lookup_symbol_skip (const char *undef_name, const ElfW(Sym) **ref,
     }
 
   if (_dl_debug_bindings)
-    _dl_debug_message (1, "binding file ", reference_name, " to ",
-		       current_value.m->l_name[0]
+    _dl_debug_message (1, "binding file ",
+		       (reference_name && reference_name[0]
+			? reference_name
+			: (_dl_argv[0] ?: "<main program>")),
+		       " to ", current_value.m->l_name[0]
 		       ? current_value.m->l_name : _dl_argv[0],
-		       ": symbol `", undef_name, "'\n", NULL);
+		       ": symbol `", undef_name, "' (skip)\n", NULL);
 
   *ref = current_value.s;
   return current_value.m->l_addr;
@@ -318,7 +326,7 @@ _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[0]
 			      ? reference_name
 			      : (_dl_argv[0] ?: "<main program>")),
 			  make_string ("symbol ", undef_name, ", version ",
@@ -334,7 +342,9 @@ _dl_lookup_versioned_symbol (const char *undef_name, const ElfW(Sym) **ref,
     {
       if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
 	/* We could find no value for a strong reference.  */
-	_dl_signal_error (0, reference_name,
+	_dl_signal_error (0, (reference_name && reference_name[0]
+			      ? reference_name
+			      : (_dl_argv[0] ?: "<main program>")),
 			  make_string (undefined_msg, undef_name,
 				       ", version ", version->name ?: NULL));
       *ref = NULL;
@@ -342,8 +352,11 @@ _dl_lookup_versioned_symbol (const char *undef_name, const ElfW(Sym) **ref,
     }
 
   if (_dl_debug_bindings)
-    _dl_debug_message (1, "binding file ", reference_name, " to ",
-		       current_value.m->l_name[0]
+    _dl_debug_message (1, "binding file ",
+		       (reference_name && reference_name[0]
+			? reference_name
+			: (_dl_argv[0] ?: "<main program>")),
+		       " to ", current_value.m->l_name[0]
 		       ? current_value.m->l_name : _dl_argv[0],
 		       ": symbol `", undef_name, "' [", version->name,
 		       "]\n", NULL);
@@ -389,18 +402,24 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
 	  char buf[sizeof undefined_msg + len];
 	  __mempcpy (__mempcpy (buf, undefined_msg, sizeof undefined_msg - 1),
 		     undef_name, len + 1);
-	  _dl_signal_error (0, reference_name, buf);
+	  _dl_signal_error (0, (reference_namee && reference_name[0]
+				? reference_name
+				: (_dl_argv[0] ?: "<main program>")), buf);
 	}
       *ref = NULL;
       return 0;
     }
 
   if (_dl_debug_bindings)
-    _dl_debug_message (1, "binding file ", reference_name, " to ",
+    _dl_debug_message (1, "binding file ",
+		       (reference_name && reference_name[0]
+			? reference_name
+			: (_dl_argv[0] ?: "<main program>")),
+		       " to ",
 		       current_value.m->l_name[0]
 		       ? current_value.m->l_name : _dl_argv[0],
 		       ": symbol `", undef_name, "' [", version->name,
-		       "]\n", NULL);
+		       "] (skip)\n", NULL);
 
   *ref = current_value.s;
   return current_value.m->l_addr;