This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Skip DT_RELACOUNT relocs on ia-64/alpha if l_addr == 0


Hi!

As both alpha and ia64 never use addend when relocating relative relocs
(ie. they do M += L) and as prelink -r libc.so.6 saved 15% startup time
on IA-32 for programs using solely -lc, I think this patch might be useful
for IA-64 and Alpha.

BTW: Have you looked at the dl-{s,}brk patch I posted
(http://sources.redhat.com/ml/libc-hacker/2002-03/msg00100.html)?

2002-04-03  Jakub Jelinek  <jakub@redhat.com>

	* elf/do-rel.h (elf_dynamic_do_rel): Skip relative relocs if
	l_addr == 0 and ELF_MACHINE_REL_RELATIVE.
	* sysdeps/alpha/dl-machine.h (ELF_MACHINE_REL_RELATIVE): Define.
	* sysdeps/ia64/dl-machine.h (ELF_MACHINE_REL_RELATIVE): Define.

--- libc/elf/do-rel.h.jj	Mon Feb  4 17:34:51 2002
+++ libc/elf/do-rel.h	Wed Apr  3 22:47:19 2002
@@ -83,11 +83,12 @@ elf_dynamic_do_rel (struct link_map *map
       weak_extern (GL(dl_rtld_map));
 # endif
       if (map != &GL(dl_rtld_map)) /* Already done in rtld itself.  */
-# ifndef DO_RELA
+# if !defined DO_RELA || defined ELF_MACHINE_REL_RELATIVE
 	/* Rela platforms get the offset from r_addend and this must
 	   be copied in the relocation address.  Therefore we can skip
 	   the relative relocations only if this is for rel
-	   relocations...  */
+	   relocations or rela relocations if they are computed as
+	   memory_loc += l_addr...  */
 	if (l_addr != 0)
 # else
 	/* ...or we know the object has been prelinked.  */
--- libc/sysdeps/alpha/dl-machine.h.jj	Sat Mar 23 11:51:04 2002
+++ libc/sysdeps/alpha/dl-machine.h	Wed Apr  3 22:49:24 2002
@@ -577,6 +577,10 @@ elf_machine_rela (struct link_map *map,
     }
 }
 
+/* Let do-rel.h know that on Alpha if l_addr is 0, all RELATIVE relocs
+   can be skipped.  */
+#define ELF_MACHINE_REL_RELATIVE 1
+
 static inline void
 elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
 			   Elf64_Addr *const reloc_addr)
--- libc/sysdeps/ia64/dl-machine.h.jj	Sat Mar 23 11:51:45 2002
+++ libc/sysdeps/ia64/dl-machine.h	Wed Apr  3 22:50:02 2002
@@ -577,6 +577,10 @@ elf_machine_rela (struct link_map *map,
     assert (! "unexpected dynamic reloc format");
 }
 
+/* Let do-rel.h know that on IA-64 if l_addr is 0, all RELATIVE relocs
+   can be skipped.  */
+#define ELF_MACHINE_REL_RELATIVE 1
+
 static inline void
 elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
 			   Elf64_Addr *const reloc_addr)

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]