From 4136ca46e391faf1a6ce58b9a1a709b248213fb4 Mon Sep 17 00:00:00 2001 From: Filippo Arcidiacono Date: Fri, 30 Jul 2010 09:17:58 +0200 Subject: ldso: Add support for LD_WARN and LD_TRACE_PRELINKING Added support for the following tracing capabilities: - LD_WARN to warn about undefined symbols during the lookup stage. - LD_TRACE_PRELINKING to trace the needed libraries of the object that we are prelinking. Signed-off-by: Filippo Arcidiacono Signed-off-by: Carmelo Amoroso --- ldso/ldso/sh/elfinterp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ldso/ldso/sh') diff --git a/ldso/ldso/sh/elfinterp.c b/ldso/ldso/sh/elfinterp.c index d3465bcd5..e94c44dad 100644 --- a/ldso/ldso/sh/elfinterp.c +++ b/ldso/ldso/sh/elfinterp.c @@ -69,7 +69,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) got_addr = (char **) instr_addr; /* Get the address of the GOT entry */ - new_addr = _dl_find_hash(symname, &_dl_loaded_modules->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT, NULL); + new_addr = _dl_find_hash(symname, &_dl_loaded_modules->symbol_scope, tpnt, NULL, ELF_RTYPE_CLASS_PLT, NULL); if (unlikely(!new_addr)) { _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname); @@ -161,6 +161,7 @@ _dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope, #endif struct elf_resolve *tls_tpnt = NULL; + struct sym_val current_value = { NULL, NULL }; reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); reloc_type = ELF32_R_TYPE(rpnt->r_info); @@ -169,7 +170,7 @@ _dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope, symname = strtab + symtab[symtab_index].st_name; if (symtab_index) { - symbol_addr = (unsigned long) _dl_find_hash(symname, scope, tpnt, + symbol_addr = (unsigned long) _dl_find_hash(symname, scope, tpnt, ¤t_value, elf_machine_type_class(reloc_type), &tls_tpnt); /* * We want to allow undefined references to weak symbols - this might @@ -186,6 +187,9 @@ _dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope, /* Let the caller to handle the error: it may be non fatal if called from dlopen */ return 1; } + if (_dl_trace_prelink) + _dl_debug_lookup (symname, tpnt, &symtab[symtab_index], + ¤t_value, elf_machine_type_class(reloc_type)); } #if defined (__SUPPORT_LD_DEBUG__) -- cgit v1.2.3