[uClibc-cvs] CVS update of uClibc/ldso/ldso (powerpc/elfinterp.c sh/elfinterp.c)

Joakim Tjernlund jocke at codepoet.org
Thu Aug 26 09:40:09 UTC 2004


    Date: Thursday, August 26, 2004 @ 03:40:09
  Author: jocke
    Path: /var/cvs/uClibc/ldso/ldso

Modified: powerpc/elfinterp.c (1.42 -> 1.43) sh/elfinterp.c (1.12 -> 1.13)

Stefan Allius writes:
"I fixed the _dl_parse_copy_information in the same way than for the
powerpc and it works fine for me. 
You may luck at the patch for the powerpc/elfinterp.c, where I change
the paramter of a dl_dprintf statement. Now we use the same
parameters than for the relocation copy."

Arch mantainers, please do the same.
When all arches has been fixed, we can remove of _dl_parse_copy_information,
it is just a waste of CPU cycles.


Index: uClibc/ldso/ldso/powerpc/elfinterp.c
diff -u uClibc/ldso/ldso/powerpc/elfinterp.c:1.42 uClibc/ldso/ldso/powerpc/elfinterp.c:1.43
--- uClibc/ldso/ldso/powerpc/elfinterp.c:1.42	Wed Aug 25 09:18:59 2004
+++ uClibc/ldso/ldso/powerpc/elfinterp.c	Thu Aug 26 03:40:08 2004
@@ -333,7 +333,7 @@
 			if(_dl_debug_move)
 				_dl_dprintf(_dl_debug_file,"\n%s move %x bytes from %x to %x",
 					    symname, symtab[symtab_index].st_size,
-					    symbol_addr, symtab[symtab_index].st_value);
+					    symbol_addr, reloc_addr);
 #endif
 			_dl_memcpy((char *) reloc_addr, (char *) finaladdr, symtab[symtab_index].st_size);
 		}
Index: uClibc/ldso/ldso/sh/elfinterp.c
diff -u uClibc/ldso/ldso/sh/elfinterp.c:1.12 uClibc/ldso/ldso/sh/elfinterp.c:1.13
--- uClibc/ldso/ldso/sh/elfinterp.c:1.12	Wed Aug 25 09:19:00 2004
+++ uClibc/ldso/ldso/sh/elfinterp.c	Thu Aug 26 03:40:09 2004
@@ -280,8 +280,16 @@
 		case R_SH_NONE:
 			break;
 		case R_SH_COPY:
-			/* handled later on */
-			break;
+			if (symbol_addr) {
+#if defined (__SUPPORT_LD_DEBUG__)
+				if(_dl_debug_move)
+					_dl_dprintf(_dl_debug_file,"\n%s move %x bytes from %x to %x",
+						    symname, symtab[symtab_index].st_size,
+						    symbol_addr, reloc_addr);
+#endif
+				_dl_memcpy((char *) reloc_addr, (char *) symbol_addr, symtab[symtab_index].st_size);
+			}
+			return 0; /* no further LD_DEBUG messages for copy relocs */
 		case R_SH_DIR32:
 		case R_SH_GLOB_DAT:
 		case R_SH_JMP_SLOT:
@@ -342,53 +350,6 @@
 
 }
 
-/* This is done as a separate step, because there are cases where
-   information is first copied and later initialized.  This results in
-   the wrong information being copied.  Someone at Sun was complaining about
-   a bug in the handling of _COPY by SVr4, and this may in fact be what he
-   was talking about.  Sigh. */
-
-/* No, there are cases where the SVr4 linker fails to emit COPY relocs
-   at all */
-static int
-_dl_do_copy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope,
-	     ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)
-{
-        int reloc_type;
-	int symtab_index;
-	unsigned long *reloc_addr;
-	unsigned long symbol_addr;
-	int goof = 0;
-	char*symname;
-
-	reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
-	reloc_type = ELF32_R_TYPE(rpnt->r_info);
-	if (reloc_type != R_SH_COPY)
-	    return 0;
-	symtab_index = ELF32_R_SYM(rpnt->r_info);
-	symbol_addr = 0;
-	symname      = strtab + symtab[symtab_index].st_name;
-
-	if (symtab_index) {
-
-		symbol_addr = (unsigned long) _dl_find_hash(symname, scope, ELF_RTYPE_CLASS_COPY);
-		if (!symbol_addr) goof++;
-	}
-	if (!goof) {
-#if defined (__SUPPORT_LD_DEBUG__)
-	        if(_dl_debug_move)
-		  _dl_dprintf(_dl_debug_file,"\n%s move %x bytes from %x to %x",
-			     symname, symtab[symtab_index].st_size,
-			     symbol_addr, symtab[symtab_index].st_value);
-#endif
-		_dl_memcpy((char *) symtab[symtab_index].st_value,
-			(char *) symbol_addr, symtab[symtab_index].st_size);
-	}
-
-	return goof;
-}
-
-
 void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
 	unsigned long rel_addr, unsigned long rel_size)
 {
@@ -401,9 +362,9 @@
 	return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
 }
 
-int _dl_parse_copy_information(struct dyn_elf *rpnt,
-	unsigned long rel_addr, unsigned long rel_size)
+int _dl_parse_copy_information(struct dyn_elf __attribute__((unused))*rpnt,
+	unsigned long __attribute__((unused))rel_addr, unsigned long __attribute__((unused))rel_size)
 {
-	return _dl_parse(rpnt->dyn, rpnt->next, rel_addr, rel_size, _dl_do_copy_reloc);
+	return 0;
 }
 



More information about the uClibc-cvs mailing list