diff options
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-lookup.c | 45 | ||||
-rw-r--r-- | elf/dl-misc.c | 6 |
2 files changed, 36 insertions, 15 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; diff --git a/elf/dl-misc.c b/elf/dl-misc.c index 1e13d0d28a..3d796360b3 100644 --- a/elf/dl-misc.c +++ b/elf/dl-misc.c @@ -77,7 +77,7 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot) /* Descriptor to write debug messages to. */ -int _dl_debug_fd; +int _dl_debug_fd = 2; void @@ -122,7 +122,9 @@ _dl_debug_message (int new_line, const char *msg, ...) if (new_line) { char buf[7] = "00000:\t"; - __write (_dl_debug_fd, _itoa_word (pid, &buf[5], 10, 0), 7); + assert (pid >= 0 && pid < 100000); + _itoa_word (pid, &buf[5], 10, 0); + __write (_dl_debug_fd, buf, 7); new_line = 0; } |