Subject: Re: COMBRELOC for ld.elf_so
To: None <port-sparc@NetBSD.org>
From: Martin Husemann <martin@duskware.de>
List: port-sparc
Date: 02/15/2007 23:23:27
--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Feb 15, 2007 at 11:21:43PM +0100, Martin Husemann wrote:
> Attached is
.. nothing, sorry

Martin

--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch

Index: mdreloc.c
===================================================================
RCS file: /cvsroot/src/libexec/ld.elf_so/arch/sparc/mdreloc.c,v
retrieving revision 1.39
diff -c -u -r1.39 mdreloc.c
--- mdreloc.c	20 May 2006 07:09:44 -0000	1.39
+++ mdreloc.c	15 Feb 2007 22:18:09 -0000
@@ -191,12 +191,16 @@
 _rtld_relocate_nonplt_objects(const Obj_Entry *obj)
 {
 	const Elf_Rela *rela;
+#define COMBRELOC
+#ifdef COMBRELOC
+	unsigned long lastsym = -1;
+#endif
+	const Elf_Sym *def = NULL;
+	const Obj_Entry *defobj = NULL;
 
 	for (rela = obj->rela; rela < obj->relalim; rela++) {
 		Elf_Addr *where;
 		Elf_Word type, value, mask;
-		const Elf_Sym *def = NULL;
-		const Obj_Entry *defobj = NULL;
 		unsigned long	 symnum;
 
 		where = (Elf_Addr *) (obj->relocbase + rela->r_offset);
@@ -235,10 +239,18 @@
 
 		if (RELOC_RESOLVE_SYMBOL(type)) {
 
-			/* Find the symbol */
-			def = _rtld_find_symdef(symnum, obj, &defobj, false);
-			if (def == NULL)
-				return (-1);
+#ifdef COMBRELOC
+			if (symnum != lastsym) {
+#endif
+				/* Find the symbol */
+				def = _rtld_find_symdef(symnum, obj, &defobj,
+				    false);
+				if (def == NULL)
+					return (-1);
+#ifdef COMBRELOC
+				lastsym = symnum;
+			}
+#endif
 
 			/* Add in the symbol's absolute address */
 			value += (Elf_Word)(defobj->relocbase + def->st_value);

--CE+1k2dSO48ffgeK--