From c4f31d2e430ec265ee528b91d87f1d3d8c64997e Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Sat, 29 Oct 2005 13:46:25 +0000 Subject: Hopefully fix the bug Oleg reported in http://uclibc.org/lists/uclibc/2005-October/012809.html This will only fix powerpc. Should be easy to fix the other arches. --- ldso/ldso/dl-elf.c | 4 +++- ldso/ldso/ldso.c | 5 +++-- ldso/ldso/powerpc/elfinterp.c | 10 +++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 28b3094d1..6c9a1fd44 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -631,7 +631,9 @@ int _dl_fixup(struct dyn_elf *rpnt, int now_flag) ElfW(Addr) reloc_addr; if (rpnt->next) - goof += _dl_fixup(rpnt->next, now_flag); + goof = _dl_fixup(rpnt->next, now_flag); + if (goof) + return goof; tpnt = rpnt->dyn; if(!(tpnt->init_flag & RELOCS_DONE)) diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 3d6884c0c..fac66ba9d 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -122,7 +122,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr, ElfW(Phdr) *ppnt; ElfW(Dyn) *dpnt; char *lpntstr; - int i, goof = 0, unlazy = 0, trace_loaded_objects = 0; + int i, unlazy = 0, trace_loaded_objects = 0; struct dyn_elf *rpnt; struct elf_resolve *tcurr; struct elf_resolve *tpnt1; @@ -724,7 +724,8 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr, * order so that COPY directives work correctly. */ if (_dl_symbol_tables) - goof += _dl_fixup(_dl_symbol_tables, unlazy); + if (_dl_fixup(_dl_symbol_tables, unlazy)) + _dl_exit(-1); for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) { if (tpnt->relro_size) diff --git a/ldso/ldso/powerpc/elfinterp.c b/ldso/ldso/powerpc/elfinterp.c index 4ec459854..3dd12f0ee 100644 --- a/ldso/ldso/powerpc/elfinterp.c +++ b/ldso/ldso/powerpc/elfinterp.c @@ -138,7 +138,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) finaladdr = (Elf32_Addr) _dl_find_hash(symname, tpnt->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT); if (unlikely(!finaladdr)) { - _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname); + _dl_dprintf(2, "%s: can't resolve symbol '%s' in lib '%s'.\n", _dl_progname, symname, tpnt->libname); _dl_exit(1); }; finaladdr += this_reloc->r_addend; @@ -379,15 +379,15 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, { int reloc_type = ELF32_R_TYPE(rpnt->r_info); #if defined (__SUPPORT_LD_DEBUG__) - _dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type)); + _dl_dprintf(2, "can't handle reloc type '%s' in lib '%s'\n", _dl_reltypes(reloc_type), tpnt->libname); #else - _dl_dprintf(2, "can't handle reloc type %x\n", reloc_type); + _dl_dprintf(2, "can't handle reloc type %x in lib '%s'\n", reloc_type, tpnt->libname); #endif - _dl_exit(-res); + return res; } if (unlikely(res >0)) { - _dl_dprintf(2, "can't resolve symbol\n"); + _dl_dprintf(2, "can't resolve symbol in lib '%s'.\n", tpnt->libname); return res; } } -- cgit v1.2.3