about summary refs log tree commit diff
path: root/sysdeps/sh
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-24 08:53:35 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-24 08:53:35 +0000
commit1721af3f967b6bf2d51cb09854fe719d0fbd40ba (patch)
tree7b8b881d877864ab9596fc5bc5586586bdf6006b /sysdeps/sh
parentc65c9d8ba06fe2b9202a84b31895c7633574bc92 (diff)
downloadglibc-1721af3f967b6bf2d51cb09854fe719d0fbd40ba.tar.gz
glibc-1721af3f967b6bf2d51cb09854fe719d0fbd40ba.tar.xz
glibc-1721af3f967b6bf2d51cb09854fe719d0fbd40ba.zip
Update.
2001-08-24  Ulrich Drepper  <drepper@redhat.com>

	* elf/do-rel.h (elf_dynamic_do_rel): If not relocating lazily, don't
	call elf_machine_rel for the last DT_RELCOUNT relocations but instead
	elf_machine_rel_relative.
	* sysdeps/alpha/dl-machine.h: Define elf_machine_rel_relative.
	Minor optimizations.
	* sysdeps/arm/dl-machine.h: Likewise.
	* sysdeps/cris/dl-machine.h: Likewise.
	* sysdeps/hppa/dl-machine.h: Likewise.
	* sysdeps/i386/dl-machine.h: Likewise.
	* sysdeps/ia64/dl-machine.h: Likewise.
	* sysdeps/m68k/dl-machine.h: Likewise.
	* sysdeps/mips/dl-machine.h: Likewise.
	* sysdeps/powerpc/dl-machine.h: Likewise.
	* sysdeps/s390/s390-32/dl-machine.h: Likewise.
	* sysdeps/s390/s390-64/dl-machine.h: Likewise.
	* sysdeps/sh/dl-machine.h: Likewise.
	* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
	* sysdeps/sparc/sparc64/dl-machine.h: Likewise.
Diffstat (limited to 'sysdeps/sh')
-rw-r--r--sysdeps/sh/dl-machine.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
index 2a740b1c13..a082e6edca 100644
--- a/sysdeps/sh/dl-machine.h
+++ b/sysdeps/sh/dl-machine.h
@@ -446,6 +446,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 		 const Elf32_Sym *sym, const struct r_found_version *version,
 		 Elf32_Addr *const reloc_addr)
 {
+  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
   Elf32_Addr value;
 
 #define COPY_UNALIGNED_WORD(sw, tw, align) \
@@ -469,7 +470,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
     } \
   }
 
-  if (ELF32_R_TYPE (reloc->r_info) == R_SH_RELATIVE)
+  if (__builtin_expect (r_type == R_SH_RELATIVE, 0))
     {
 #ifndef RTLD_BOOTSTRAP
       if (map != &_dl_rtld_map) /* Already done in rtld itself.	 */
@@ -485,7 +486,11 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  COPY_UNALIGNED_WORD (value, *reloc_addr, (int) reloc_addr & 3);
 	}
     }
-  else if (ELF32_R_TYPE (reloc->r_info) != R_SH_NONE)
+#ifndef RTLD_BOOTSTRAP
+  else if (__builtin_expect (r_type 1= R_SH_NONE, 0))
+    return;
+#endif
+  else
     {
       const Elf32_Sym *const refsym = sym;
 
@@ -550,6 +555,20 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  break;
 	}
     }
+}
+
+static inline void
+elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
+			  Elf32_Addr *const reloc_addr)
+{
+  if (reloc->r_addend)
+    value = l_addr + reloc->r_addend;
+  else
+    {
+      COPY_UNALIGNED_WORD (*reloc_addr, value, (int) reloc_addr & 3);
+      value += l_addr;
+    }
+  COPY_UNALIGNED_WORD (value, *reloc_addr, (int) reloc_addr & 3);
 
 #undef COPY_UNALIGNED_WORD
 }