1998-03-10 00:10  Ulrich Drepper  <drepper@cygnus.com>

	* elf/dl-lookup.c (do_lookup): Remove list and n parameter and add
	instead scope.  If debugging display information about symbol
	resolving.
	(_dl_lookup_symbol): Call do_lookup with correct parameters.
	(_dl_lookup_symbol_skip): Likewise.
	(_dl_lookup_versioned_symbol): Likewise.
	(_dl_lookup_versioned_symbol_skip): Likewise.
	* elf/dl-support.c: Define _dl_debug_symbols.
	* elf/link.h: Add declaration for _dl_debug_symbols.
	* elf/rtld.c: Define _dl_debug_symbols.
	(process_dl_debug): Recognize symbols option.
This commit is contained in:
Ulrich Drepper 1998-03-10 00:16:33 +00:00
parent 1393c74581
commit de100ca78f
5 changed files with 44 additions and 16 deletions

View File

@ -1,3 +1,17 @@
1998-03-10 00:10 Ulrich Drepper <drepper@cygnus.com>
* elf/dl-lookup.c (do_lookup): Remove list and n parameter and add
instead scope. If debugging display information about symbol
resolving.
(_dl_lookup_symbol): Call do_lookup with correct parameters.
(_dl_lookup_symbol_skip): Likewise.
(_dl_lookup_versioned_symbol): Likewise.
(_dl_lookup_versioned_symbol_skip): Likewise.
* elf/dl-support.c: Define _dl_debug_symbols.
* elf/link.h: Add declaration for _dl_debug_symbols.
* elf/rtld.c: Define _dl_debug_symbols.
(process_dl_debug): Recognize symbols option.
1998-03-09 23:36 Ulrich Drepper <drepper@cygnus.com> 1998-03-09 23:36 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/init-first.c [!PIC]: Expect arguments * sysdeps/unix/sysv/linux/init-first.c [!PIC]: Expect arguments

View File

@ -63,10 +63,12 @@ struct sym_val
static inline int static inline int
do_lookup (const char *undef_name, unsigned long int hash, do_lookup (const char *undef_name, unsigned long int hash,
const ElfW(Sym) *ref, struct sym_val *result, const ElfW(Sym) *ref, struct sym_val *result,
struct link_map *list[], size_t i, size_t n, struct link_map *scope, size_t i, const char *reference_name,
const char *reference_name, const struct r_found_version *version, const struct r_found_version *version, struct link_map *skip,
struct link_map *skip, int reloc_type) int reloc_type)
{ {
struct link_map **list = scope->l_searchlist;
size_t n = scope->l_nsearchlist;
struct link_map *map; struct link_map *map;
for (; i < n; ++i) for (; i < n; ++i)
@ -96,6 +98,12 @@ do_lookup (const char *undef_name, unsigned long int hash,
if (map->l_info[DT_SYMTAB] == NULL) if (map->l_info[DT_SYMTAB] == NULL)
continue; continue;
/* Print some debugging info if wanted. */
if (_dl_debug_symbols)
_dl_debug_message ("\tsymbol=", undef_name, "; lookup in file=",
map->l_name[0] ? map->l_name : _dl_argv[0],
"\n", NULL);
symtab = ((void *) map->l_addr + map->l_info[DT_SYMTAB]->d_un.d_ptr); symtab = ((void *) map->l_addr + map->l_info[DT_SYMTAB]->d_un.d_ptr);
strtab = ((void *) map->l_addr + map->l_info[DT_STRTAB]->d_un.d_ptr); strtab = ((void *) map->l_addr + map->l_info[DT_STRTAB]->d_un.d_ptr);
verstab = map->l_versyms; verstab = map->l_versyms;
@ -214,8 +222,7 @@ _dl_lookup_symbol (const char *undef_name, const ElfW(Sym) **ref,
/* Search the relevant loaded objects for a definition. */ /* Search the relevant loaded objects for a definition. */
for (scope = symbol_scope; *scope; ++scope) for (scope = symbol_scope; *scope; ++scope)
if (do_lookup (undef_name, hash, *ref, &current_value, if (do_lookup (undef_name, hash, *ref, &current_value,
(*scope)->l_searchlist, 0, (*scope)->l_nsearchlist, *scope, 0, reference_name, NULL, NULL, reloc_type))
reference_name, NULL, NULL, reloc_type))
break; break;
if (current_value.s == NULL) if (current_value.s == NULL)
@ -261,12 +268,10 @@ _dl_lookup_symbol_skip (const char *undef_name, const ElfW(Sym) **ref,
assert (i < (*scope)->l_ndupsearchlist); assert (i < (*scope)->l_ndupsearchlist);
if (! do_lookup (undef_name, hash, *ref, &current_value, if (! do_lookup (undef_name, hash, *ref, &current_value,
(*scope)->l_dupsearchlist, i, (*scope)->l_ndupsearchlist, *scope, i, reference_name, NULL, skip_map, 0))
reference_name, NULL, skip_map, 0))
while (*++scope) while (*++scope)
if (do_lookup (undef_name, hash, *ref, &current_value, if (do_lookup (undef_name, hash, *ref, &current_value,
(*scope)->l_dupsearchlist, 0, (*scope)->l_ndupsearchlist, *scope, 0, reference_name, NULL, skip_map, 0))
reference_name, NULL, skip_map, 0))
break; break;
if (current_value.s == NULL) if (current_value.s == NULL)
@ -306,8 +311,7 @@ _dl_lookup_versioned_symbol (const char *undef_name, const ElfW(Sym) **ref,
for (scope = symbol_scope; *scope; ++scope) for (scope = symbol_scope; *scope; ++scope)
{ {
int res = do_lookup (undef_name, hash, *ref, &current_value, int res = do_lookup (undef_name, hash, *ref, &current_value,
(*scope)->l_searchlist, 0, (*scope)->l_nsearchlist, *scope, 0, reference_name, version, NULL, reloc_type);
reference_name, version, NULL, reloc_type);
if (res > 0) if (res > 0)
break; break;
@ -369,12 +373,10 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
assert (i < (*scope)->l_ndupsearchlist); assert (i < (*scope)->l_ndupsearchlist);
if (! do_lookup (undef_name, hash, *ref, &current_value, if (! do_lookup (undef_name, hash, *ref, &current_value,
(*scope)->l_dupsearchlist, i, (*scope)->l_ndupsearchlist, *scope, i, reference_name, version, skip_map, 0))
reference_name, version, skip_map, 0))
while (*++scope) while (*++scope)
if (do_lookup (undef_name, hash, *ref, &current_value, if (do_lookup (undef_name, hash, *ref, &current_value,
(*scope)->l_dupsearchlist, 0, (*scope)->l_ndupsearchlist, *scope, 0, reference_name, version, skip_map, 0))
reference_name, version, skip_map, 0))
break; break;
if (current_value.s == NULL) if (current_value.s == NULL)

View File

@ -38,6 +38,7 @@ size_t _dl_platformlen;
int _dl_debug_libs; int _dl_debug_libs;
int _dl_debug_impcalls; int _dl_debug_impcalls;
int _dl_debug_bindings; int _dl_debug_bindings;
int _dl_debug_symbols;
/* If nonzero print warnings about problematic situations. */ /* If nonzero print warnings about problematic situations. */
int _dl_verbose; int _dl_verbose;

View File

@ -252,6 +252,7 @@ extern struct link_map *_dl_profile_map;
extern int _dl_debug_libs; extern int _dl_debug_libs;
extern int _dl_debug_impcalls; extern int _dl_debug_impcalls;
extern int _dl_debug_bindings; extern int _dl_debug_bindings;
extern int _dl_debug_symbols;
/* File deccriptor to write debug messages to. */ /* File deccriptor to write debug messages to. */
extern int _dl_debug_fd; extern int _dl_debug_fd;

View File

@ -77,6 +77,7 @@ struct link_map *_dl_profile_map;
int _dl_debug_libs; int _dl_debug_libs;
int _dl_debug_impcalls; int _dl_debug_impcalls;
int _dl_debug_bindings; int _dl_debug_bindings;
int _dl_debug_symbols;
/* Set nonzero during loading and initialization of executable and /* Set nonzero during loading and initialization of executable and
libraries, cleared before the executable's entry point runs. This libraries, cleared before the executable's entry point runs. This
@ -937,7 +938,7 @@ process_dl_debug (char *dl_debug)
any_debug = 1; any_debug = 1;
dl_debug += 8; dl_debug += 8;
} }
if (strncmp (dl_debug, "libs", 4) == 0 else if (strncmp (dl_debug, "libs", 4) == 0
&& (issep (dl_debug[4]) || dl_debug[4] == '\0')) && (issep (dl_debug[4]) || dl_debug[4] == '\0'))
{ {
_dl_debug_libs = 1; _dl_debug_libs = 1;
@ -954,12 +955,21 @@ Valid options for the LD_DEBUG environment variable are:\n\
bindings display information about symbol binding\n\ bindings display information about symbol binding\n\
help display this help message and exit\n\ help display this help message and exit\n\
libs display library search paths\n\ libs display library search paths\n\
symbols display symbol table processing\n\
\n\ \n\
To direct the debugging output into a file instead of standard output\n\ To direct the debugging output into a file instead of standard output\n\
a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n", a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n",
NULL); NULL);
_exit (0); _exit (0);
} }
else if (strncmp (dl_debug, "symbols", 7) == 0
&& (issep (dl_debug[7]) || dl_debug[7] == '\0'))
{
_dl_debug_symbols = 1;
_dl_debug_impcalls = 1;
any_debug = 1;
dl_debug += 7;
}
else else
/* Skip everything until next separator. */ /* Skip everything until next separator. */
do do