Browse Source

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.

Joakim Tjernlund 19 years ago
parent
commit
c4f31d2e43
3 changed files with 11 additions and 8 deletions
  1. 3 1
      ldso/ldso/dl-elf.c
  2. 3 2
      ldso/ldso/ldso.c
  3. 5 5
      ldso/ldso/powerpc/elfinterp.c

+ 3 - 1
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)) 

+ 3 - 2
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)

+ 5 - 5
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;
 		}
 	  }