[uClibc-cvs] uClibc/ldso/ldso/powerpc elfinterp.c,1.33,1.34

Erik Andersen andersen at uclibc.org
Thu Jan 29 12:18:57 UTC 2004


Update of /var/cvs/uClibc/ldso/ldso/powerpc
In directory nail:/tmp/cvs-serv13904/ldso/powerpc

Modified Files:
	elfinterp.c 
Log Message:
Modify interfaces for _dl_parse_relocation_information()
_dl_parse_lazy_relocation_information() and _dl_parse_copy_information()
so they are all consistant, allowing for future consolidation.

Trim some trailing whitespace as well.


Index: elfinterp.c
===================================================================
RCS file: /var/cvs/uClibc/ldso/ldso/powerpc/elfinterp.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- elfinterp.c	29 Jan 2004 10:48:05 -0000	1.33
+++ elfinterp.c	29 Jan 2004 12:18:54 -0000	1.34
@@ -1,8 +1,8 @@
 /* vi: set sw=4 ts=4: */
 /* powerpc shared library loader suppport
  *
- * Copyright (C) 2001-2002,  David A. Schleef
- * Copyright (C) 2003, Erik Andersen
+ * Copyright (C) 2001-2002 David A. Schleef
+ * Copyright (C) 2003-2004 Erik Andersen
  *
  * All rights reserved.
  *
@@ -46,9 +46,9 @@
 static const char *
 _dl_reltypes(int type)
 {
-  static char buf[22];  
+  static char buf[22];
   const char *str;
-  
+
   if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
       NULL == (str = _dl_reltypes_tab[type]))
   {
@@ -57,7 +57,7 @@
   return str;
 }
 
-static 
+static
 void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
 {
   if(_dl_debug_symbols)
@@ -74,7 +74,7 @@
   }
 }
 
-static 
+static
 void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt)
 {
   if(_dl_debug_reloc)
@@ -83,7 +83,7 @@
     const char *sym;
     symtab_index = ELF32_R_SYM(rpnt->r_info);
     sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
-    
+
   if(_dl_debug_symbols)
 	  _dl_dprintf(_dl_debug_file, "\n\t");
   else
@@ -208,7 +208,7 @@
 #endif
 
 	/* Get the address of the GOT entry */
-	finaladdr = (Elf32_Addr) _dl_find_hash(strtab + symtab[symtab_index].st_name, 
+	finaladdr = (Elf32_Addr) _dl_find_hash(strtab + symtab[symtab_index].st_name,
 						tpnt->symbol_scope, tpnt, resolver);
 	if (!finaladdr) {
 		_dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname);
@@ -272,9 +272,9 @@
 
 	  for (i = 0; i < rel_size; i++, rpnt++) {
 	        int res;
-	    
+
 		symtab_index = ELF32_R_SYM(rpnt->r_info);
-		
+
 		/* When the dynamic linker bootstrapped itself, it resolved some symbols.
 		   Make sure we do not do them again */
 		if (!symtab_index && tpnt->libtype == program_interpreter)
@@ -293,10 +293,10 @@
 		if (res==0) continue;
 
 		_dl_dprintf(2, "\n%s: ",_dl_progname);
-		
+
 		if (symtab_index)
 		  _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name);
-		  
+
 		if (res <0)
 		{
 		        int reloc_type = ELF32_R_TYPE(rpnt->r_info);
@@ -304,7 +304,7 @@
 			_dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type));
 #else
 			_dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
-#endif			
+#endif
 			_dl_exit(-res);
 		}
 		else if (res >0)
@@ -341,7 +341,7 @@
 	symtab_index = ELF32_R_SYM(rpnt->r_info);
 	symname      = strtab + symtab[symtab_index].st_name;
 
-	symbol_addr = (unsigned long) _dl_find_hash(symname, scope, 
+	symbol_addr = (unsigned long) _dl_find_hash(symname, scope,
 						    (reloc_type == R_PPC_JMP_SLOT ? tpnt : NULL), symbolrel);
 	/*
 	 * We want to allow undefined references to weak symbols - this might
@@ -369,7 +369,7 @@
 	case R_PPC_JMP_SLOT:
 	{
 		Elf32_Sword delta = finaladdr - (Elf32_Word)reloc_addr;
-		
+
 		if (delta<<6>>6 == delta) {
 			*reloc_addr = OPCODE_B(delta);
 #if 0
@@ -458,7 +458,7 @@
    a bug in the handling of _COPY by SVr4, and this may in fact be what he
    was talking about.  Sigh. */
 static int
-_dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
+_dl_do_copy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope,
 	     ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)
 {
 	int reloc_type;
@@ -467,15 +467,15 @@
 	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_PPC_COPY) 
+	if (reloc_type != R_PPC_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, NULL, copyrel);
 		if (!symbol_addr) goof++;
@@ -494,9 +494,10 @@
 	return goof;
 }
 
-void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt, 
+void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
 	unsigned long rel_addr, unsigned long rel_size, int type)
 {
+	struct elf_resolve *tpnt = rpnt->dyn;
 	Elf32_Word *plt, offset, i,  num_plt_entries, rel_offset_words;
 
 	(void) type;
@@ -525,7 +526,7 @@
 	   (In a multiprocessor system, the effect is more complex.)
 	   Most of the PLT shouldn't be in the instruction cache, but
 	   there may be a little overlap at the start and the end.
-	   
+
 	   Assumes that dcbst and icbi apply to lines of 16 bytes or
 	   more.  Current known line sizes are 16, 32, and 128 bytes.  */
 	for (i = 0; i < rel_offset_words; i += 4)
@@ -537,16 +538,16 @@
 	PPC_ISYNC;
 }
 
-int _dl_parse_relocation_information(struct elf_resolve *tpnt, 
+int _dl_parse_relocation_information(struct dyn_elf *rpnt,
 	unsigned long rel_addr, unsigned long rel_size, int type)
 {
-	(void) type;
-	return _dl_parse(tpnt, tpnt->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
+	return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
 }
 
-int _dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr, 
-	unsigned long rel_size, int type)
+int _dl_parse_copy_information(struct dyn_elf *rpnt,
+	unsigned long rel_addr, unsigned long rel_size, int type)
 {
-	(void) type;
-	return _dl_parse(xpnt->dyn, xpnt->next, rel_addr, rel_size, _dl_do_copy);
+	return _dl_parse(rpnt->dyn, rpnt->next, rel_addr, rel_size, _dl_do_copy_reloc);
 }
+
+




More information about the uClibc-cvs mailing list